code: def handle_detached(sender, device):
      
      vendor, product, sernum, ifcount, description = device
  
      # Close and remove the device from our list.
      if sernum in list(__devices.keys()):
          __devices[sernum].close()
  
          del __devices[sernum]
  
      print('detached', sernum)
docs: Handles detached events from USBDevice.start_detection().