code: def count_base_units(units):
      
      ret = {}
      for unit in units:
          factor, base_unit = get_conversion_factor(unit)
  
          ret.setdefault(base_unit, 0)
          ret[base_unit] += 1
  
      return ret
docs: Returns a dict mapping names of base units to how many times they
      appear in the given iterable of units.  Effectively this counts how
      many length units you have, how many time units, and so forth.