


'''simple docstring'''






a_   :      Optional[int]				    =      {
    "meter": "m",
    "kilometer": "km",
    "megametre": "Mm",
    "gigametre": "Gm",
    "terametre": "Tm",
    "petametre": "Pm",
    "exametre": "Em",
    "zettametre": "Zm",
    "yottametre": "Ym",
}
# Exponent of the factor(meter)
a_   :      Union[str, Any]				    =      {
    "m": 0,
    "km": 3,
    "Mm": 6,
    "Gm": 9,
    "Tm": 1_2,
    "Pm": 1_5,
    "Em": 1_8,
    "Zm": 2_1,
    "Ym": 2_4,
}






def 		_A			(lowerCAmelCase__					:Dict			,  lowerCAmelCase__					:Optional[int]			,  lowerCAmelCase__					:Optional[int]						)				->					float:




     '''simple docstring'''



     _a      =							from_type.lower().strip('s'						)
     _a      =							to_type.lower().strip('s'						)

     _a      =							UNIT_SYMBOL.get(__lowerCAmelCase			,  __lowerCAmelCase						)
     _a      =							UNIT_SYMBOL.get(__lowerCAmelCase			,  __lowerCAmelCase						)

     if from_sanitized not in METRIC_CONVERSION:
          _a      =							(
              f'Invalid \'from_type\' value: {from_type!r}.\n'
              f'Conversion abbreviations are: {", ".join(__lowerCAmelCase						)}'
          )
          raise ValueError(__lowerCAmelCase						)
     if to_sanitized not in METRIC_CONVERSION:
          _a      =							(
              f'Invalid \'to_type\' value: {to_type!r}.\n'
              f'Conversion abbreviations are: {", ".join(__lowerCAmelCase						)}'
          )
          raise ValueError(__lowerCAmelCase						)
     _a      =							METRIC_CONVERSION[from_sanitized]
     _a      =							METRIC_CONVERSION[to_sanitized]
     _a      =							1

     if from_exponent > to_exponent:
          _a      =							from_exponent - to_exponent
     else:
          _a      =							-(to_exponent - from_exponent)

     return value * pow(10			,  __lowerCAmelCase						)


if __name__ == "__main__":
 from doctest import testmod

 testmod()





'''simple docstring'''






from timeit import timeit






def 		_A			(lowerCAmelCase__					:int						)				->					int:




     '''simple docstring'''



     if number < 0:
          raise ValueError('the value of input must not be negative'						)
     _a      =							0
     while number:
          number &= number - 1
          result += 1
     return result






def 		_A			(lowerCAmelCase__					:int						)				->					int:




     '''simple docstring'''



     if number < 0:
          raise ValueError('the value of input must not be negative'						)
     _a      =							0
     while number:
          if number % 2 == 1:
               result += 1
          number >>= 1
     return result






def 		_A			()				->					None:




     '''simple docstring'''



     def do_benchmark(lowerCAmelCase__					:int						) -> None:
          _a      =							'import __main__ as z'
          print(f'Benchmark when {number = }:'						)
          print(f'{get_set_bits_count_using_modulo_operator(lowerCAmelCase__						) = }'						)
          _a      =							timeit('z.get_set_bits_count_using_modulo_operator(25)'			,  setup=lowerCAmelCase__						)
          print(f'timeit() runs in {timing} seconds'						)
          print(f'{get_set_bits_count_using_brian_kernighans_algorithm(lowerCAmelCase__						) = }'						)
          _a      =							timeit(
              'z.get_set_bits_count_using_brian_kernighans_algorithm(25)'			,  setup=lowerCAmelCase__			,  )
          print(f'timeit() runs in {timing} seconds'						)

     for number in (25, 37, 58, 0):
          do_benchmark(lowerCAmelCase__						)
          print()


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 benchmark()

