code: def generate_inverse_mapping(order):
      
      mapping = generate_mapping(order)
      inv_mapping = {}
      for key,value in mapping.items():
          inv_mapping[value] = key
  
      return inv_mapping
docs: Genereate a lambda entry -> PN order map.
  
      This function will generate the opposite of generate mapping. So where
      generate_mapping gives dict[key] = item this will give
      dict[item] = key. Valid PN orders are:
      {}
  
      Parameters
      ----------
      order : string
          A string containing a PN order. Valid values are given above.
  
      Returns
      --------
      mapping : dictionary
          An inverse mapping between the active Lambda terms and index in the
          metric