Deleting All from Scene

One of my script tools deletes all objects from the scene, including the materials and images they were using. To do it I use the following:

    bpy.ops.object.select_all(action='SELECT')
    bpy.ops.object.delete(use_global=False)
    
    bpy.ops.outliner.orphans_purge()
    bpy.ops.outliner.orphans_purge()
    bpy.ops.outliner.orphans_purge()

I run the purge 3 times to delete the orphaned materials and images, since I don’t know of a way to erase all with one command. Anyone know of a way?

Thanks.