code: def invert_dict(d):
      inverted_dict = defaultdict(list)
      for key in d:
          if hasattr(d[key], "__iter__"):
              for term in d[key]:
                  inverted_dict[term].append(key)
          else:
              inverted_dict[d[key]] = key
      return inverted_dict
  
imports: import inspect
  import locale
  import os
  import pydoc
  import re
  import textwrap
  import unicodedata
  import warnings
  from collections import defaultdict, deque
  from itertools import chain, combinations, islice, tee
  from pprint import pprint
  from urllib.request import HTTPPasswordMgrWithDefaultRealm, ProxyBasicAuthHandler, ProxyDigestAuthHandler, ProxyHandler, build_opener, getproxies, install_opener
  from nltk.collections import *
  from nltk.internals import deprecated, raise_unorderable_types, slice_bounds
label_desc: Use image node_id 21 for calling a global function with example usage: invert_dict(d) and returns: inverted_dict