code: def get_string(dev, index, langid = None):
      r
      if 0 == index:
          return None
  
      from usb.control import get_descriptor
      langids = dev.langids
  
      if 0 == len(langids):
          raise ValueError("The device has no langid")
      if langid is None:
          langid = langids[0]
      elif langid not in langids:
          raise ValueError("The device does not support the specified langid")
  
      buf = get_descriptor(
                  dev,
                  255, # Maximum descriptor size
                  DESC_TYPE_STRING,
                  index,
                  langid
              )
      if hexversion >= 0x03020000:
          return buf[2:buf[0]].tobytes().decode('utf-16-le')
      else:
          return buf[2:buf[0]].tostring().decode('utf-16-le')
docs: r"""Retrieve a string descriptor from the device.
  
      dev is the Device object which the string will be read from.
  
      index is the string descriptor index and langid is the Language
      ID of the descriptor. If langid is omitted, the string descriptor
      of the first Language ID will be returned.
  
      Zero is never the index of a real string. The USB spec allows a device to
      use zero in a string index field to indicate that no string is provided.
      So the caller does not have to treat that case specially, this function
      returns None if passed an index of zero, and generates no traffic
      to the device.
  
      The return value is the unicode string present in the descriptor, or None
      if the requested index was zero.
  
      It is a ValueError to request a real string (index not zero), if: the
      device's langid tuple is empty, or with an explicit langid the device does
      not support.