code: def dict2tuple(mydict):
      
      result = []
      for key in mydict.keys():
          # There are three cases we need to consider:
          # dictionary, list, and other values
          try:
              # We test whether the object is a dictionary-like
              # structure via accessing the
              keys = mydict[key].keys()
              key_result = dict2tuple(mydict[key])
          except AttributeError:
              # So we have either a list or a value
              if type(mydict[key]) == type([]):
                  key_result = []
                  for elt in mydict[key]:
                      key_result.append(dict2tuple(elt))
              else:
                  key_result = mydict[key]
          result.append((key, key_result))
      return tuple(result)
docs: Turn a dictionary of the form used by DINGO
      (i.e., a key is mapped to either another dictionary,
      a list or a value) into a tuple-representation.
      This is useful for providing a standard python object that
      observes the order of elements (which standard dictionaries don't).