code: def splitclass(classofdevice):
      
      if not isinstance(classofdevice, int):
          try:
              classofdevice = int(classofdevice)
          except (TypeError, ValueError):
              raise TypeError("Given device class '%s' cannot be split" % \
                  str(classofdevice))
  
      data = classofdevice >> 2   # skip over the 2 "format" bits
      service = data >> 11
      major = (data >> 6) & 0x1F
      minor = data & 0x3F
      return (service, major, minor)
docs: Splits the given class of device to return a 3-item tuple with the
      major service class, major device class and minor device class values.
  
      These values indicate the device's major services and the type of the
      device (e.g. mobile phone, laptop, etc.). If you google for
      "assigned numbers bluetooth baseband" you might find some documents
      that discuss how to extract this information from the class of device.
  
      Example:
          >>> splitclass(1057036)
          (129, 1, 3)
          >>>