<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_unit_factor(cls, unit):
 """ 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 """

        try:
            if isinstance(unit, str):
                unit = cls.UNIT_FACTOR_NAMES[unit]
            return cls.UNIT_FACTORS[unit]
        except KeyError:
            raise UnsupportedUnitError()