code: def as_base_units(self):
          
          b = collections.defaultdict(int)
          factor = 1
          for k, v in self.items():
              derived = False
              for d in DERIVED_UNITS.values():
                  if k in d:
                      for k2, v2 in d[k].items():
                          if isinstance(k2, Number):
                              factor *= k2 ** (v2 * v)
                          else:
                              b[k2] += v2 * v
                      derived = True
                      break
              if not derived:
                  si, f = _get_si_unit(k)
                  b[si] += v
                  factor *= f ** v
          return {k: v for k, v in b.items() if v != 0}, factor
docs: Converts all units to base SI units, including derived units.
  
          Returns:
              (base_units_dict, scaling factor). base_units_dict will not
              contain any constants, which are gathered in the scaling factor.