def _find_allocated_slots(devices):
 taken = {}
 for device in devices:
  if (hasattr(device, 'controllerKey') and hasattr(device, 'unitNumber')):
   unit_numbers = taken.setdefault(device.controllerKey, [])
   unit_numbers.append(device.unitNumber)
  if _is_scsi_controller(device):
   unit_numbers = taken.setdefault(device.key, [])
   unit_numbers.append(device.scsiCtlrUnitNumber)
 return taken

def _find_allocated_slots ( devices ) : taken = { } for device in devices : if ( hasattr ( device , 'controllerKey' ) and hasattr ( device , 'unitNumber' ) ) : unit_numbers = taken . setdefault ( device . controllerKey , [ ] ) unit_numbers . append ( device . unitNumber ) if _is_scsi_controller ( device ) : unit_numbers = taken . setdefault ( device . key , [ ] ) unit_numbers . append ( device . scsiCtlrUnitNumber ) return taken
return dictionary which maps controller_key to list of allocated unit numbers for that controller_key .