code: def load_units():
      
      names = {}
      lowers = defaultdict(list)
      symbols = defaultdict(list)
      surfaces = defaultdict(list)
      for unit in json.load(open(os.path.join(TOPDIR, 'units.json'))):
  
          try:
              assert unit['name'] not in names
          except AssertionError:
              msg = 'Two units with same name in units.json: %s' % unit['name']
              raise Exception(msg)
  
          obj = c.Unit(name=unit['name'], surfaces=unit['surfaces'],
                       entity=ENTITIES[unit['entity']], uri=unit['URI'],
                       symbols=unit['symbols'], dimensions=unit['dimensions'])
  
          names[unit['name']] = obj
  
          for symbol in unit['symbols']:
              surfaces[symbol].append(obj)
              lowers[symbol.lower()].append(obj)
              if unit['entity'] == 'currency':
                  symbols[symbol].append(obj)
  
          for surface in unit['surfaces']:
              surfaces[surface].append(obj)
              lowers[surface.lower()].append(obj)
              split = surface.split()
              index = None
              if ' per ' in surface:
                  index = split.index('per') - 1
              elif 'degree ' in surface:
                  index = split.index('degree')
              if index is not None:
                  plural = ' '.join([i if num != index else
                                     PLURALS.plural(split[index]) for num, i in
                                     enumerate(split)])
              else:
                  plural = PLURALS.plural(surface)
              if plural != surface:
                  surfaces[plural].append(obj)
                  lowers[plural.lower()].append(obj)
  
      dimensions_uni = get_dimensions_units(names)
  
      return names, surfaces, lowers, symbols, dimensions_uni
docs: Load units from JSON file.