code: def recordlookup(table, key, dictionary=None):
      
  
      if dictionary is None:
          dictionary = dict()
  
      it = iter(table)
      hdr = next(it)
      flds = list(map(text_type, hdr))
      keyindices = asindices(hdr, key)
      assert len(keyindices) > 0, 'no key selected'
      getkey = operator.itemgetter(*keyindices)
      for row in it:
          k = getkey(row)
          rec = Record(row, flds)
          if k in dictionary:
              # work properly with shelve
              l = dictionary[k]
              l.append(rec)
              dictionary[k] = l
          else:
              dictionary[k] = [rec]
      return dictionary
docs: Load a dictionary with data from the given table, mapping to record objects.