def losetup_detach_all(root_path):
 for (device_file, backing_file) in _losetup_list():
  try:
   backing_file.segmentsFrom(root_path)
  except ValueError:
   pass
  else:
   losetup_detach(device_file)

def losetup_detach_all ( root_path ) : for ( device_file , backing_file ) in _losetup_list ( ) : try : backing_file . segmentsFrom ( root_path ) except ValueError : pass else : losetup_detach ( device_file )
detach all loop devices associated with files contained in root_path .