code: def _get_unit_factor(cls, unit):
          
          try:
              if isinstance(unit, str):
                  unit = cls.UNIT_FACTOR_NAMES[unit]
              return cls.UNIT_FACTORS[unit]
          except KeyError:
              raise UnsupportedUnitError()
docs: Returns the unit factor depending on the unit constant
  
              :param int unit: the unit of the factor requested
  
              :returns: a function to convert the raw sensor value to the given unit
              :rtype: lambda function
  
              :raises UnsupportedUnitError: if the unit is not supported