code: def _recursive_cleanup(foo):
      
      if isinstance(foo, dict):
          for (key, val) in list(foo.items()):
              if isinstance(val, dict):
                  _recursive_cleanup(val)
              if val == "" or val == [] or val == {}:
                  del foo[key]
docs: Aggressively cleans up things that look empty.