code: def find_devices(vendor=None, product=None, serial_number=None,
                   custom_match=None, **kwargs):
      
      kwargs = kwargs or {}
      attrs = {}
      if isinstance(vendor, str):
          attrs['manufacturer'] = vendor
      elif vendor is not None:
          kwargs['idVendor'] = vendor
  
      if isinstance(product, str):
          attrs['product'] = product
      elif product is not None:
          kwargs['idProduct'] = product
  
      if serial_number:
          attrs['serial_number'] = str(serial_number)
  
      if attrs:
          def cm(dev):
              if custom_match is not None and not custom_match(dev):
                  return False
              for attr, pattern in attrs.items():
                  if not fnmatch(getattr(dev, attr).lower(), pattern.lower()):
                      return False
              return True
      else:
          cm = custom_match
  
      return usb.core.find(find_all=True, custom_match=cm, **kwargs)
docs: Find connected USB devices matching certain keywords.
  
      Wildcards can be used for vendor, product and serial_number.
  
      :param vendor: name or id of the vendor (manufacturer)
      :param product: name or id of the product
      :param serial_number: serial number.
      :param custom_match: callable returning True or False that takes a device as only input.
      :param kwargs: other properties to match. See usb.core.find
      :return: