code: def get_conversion_factor(self, new_unit):
          
          uo_base, ofactor = self.as_base_units
          un_base, nfactor = Unit(new_unit).as_base_units
          units_new = sorted(un_base.items(),
                             key=lambda d: _UNAME2UTYPE[d[0]])
          units_old = sorted(uo_base.items(),
                             key=lambda d: _UNAME2UTYPE[d[0]])
          factor = ofactor / nfactor
          for uo, un in zip(units_old, units_new):
              if uo[1] != un[1]:
                  raise UnitError("Units %s and %s are not compatible!" % (uo, un))
              c = ALL_UNITS[_UNAME2UTYPE[uo[0]]]
              factor *= (c[uo[0]] / c[un[0]]) ** uo[1]
          return factor
docs: Returns a conversion factor between this unit and a new unit.
          Compound units are supported, but must have the same powers in each
          unit type.
  
          Args:
              new_unit: The new unit.