code: def dedupe_list_of_dicts(ld):
      
      def _freeze(o):
          """Recursively freezes a dict into an hashable object.
  
          Adapted from http://stackoverflow.com/a/21614155/374865.
          """
          if isinstance(o, dict):
              return frozenset((k, _freeze(v)) for k, v in six.iteritems(o))
          elif isinstance(o, (list, tuple)):
              return tuple(_freeze(v) for v in o)
          else:
              return o
  
      result = []
      seen = set()
  
      for d in ld:
          f = _freeze(d)
          if f not in seen:
              result.append(d)
              seen.add(f)
  
      return result
docs: Remove duplicates from a list of dictionaries preserving the order.
  
      We can't use the generic list helper because a dictionary isn't hashable.
      Adapted from http://stackoverflow.com/a/9427216/374865.