code: def compress(self, d=DEFAULT):
          
          if d is DEFAULT:
              d = self
          if isinstance(d, list):
              l = [v for v in (self.compress(v) for v in d)]
              try:
                  return list(set(l))
              except TypeError:
                  # list contains not hashables
                  ret = []
                  for i in l:
                      if i not in ret:
                          ret.append(i)
                  return ret
          elif isinstance(d, type(self)):
              return type(self)({k: v for k, v in ((k, self.compress(v)) for k, v in d.items())})
          elif isinstance(d, dict):
              return {k: v for k, v in ((k, self.compress(v)) for k, v in d.items())}
          return d
docs: Returns a copy of d with compressed leaves.