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