code: def delete_depending_items(dependent_item):
      """deletes the item's depending items, and then the item"""
      depending_items = None
      try:
          depending_items = dependent_item.dependent_to()
          if depending_items["list"]:
              for item in depending_items["list"]:
                  delete_depending_items(item)
      except:
          print(
              "=== could not get item list %s" % dependent_item.homepage
          )
  
      if dependent_item.protected:
          dependent_item.protect(False)
      try:
          print("=== deleting the item: %s" % dependent_item.homepage)
          dependent_item.delete()
      except:
          print(
              "=== could not delete non-dependent item %s"
              % dependent_item.homepage
          )
  
file_path: arcgis-python-api/misc/_common.py
imports: from arcgis.gis import GIS
label_desc: Use image node_id 2 for calling a global function with example usage: delete_depending_items(dependent_item) without return types