code: def invert_graph(graph):
      """
      Inverts a directed graph.
  
      :param graph: the graph, represented as a dictionary of sets
      :type graph: dict(set)
      :return: the inverted graph
      :rtype: dict(set)
      """
      inverted = {}
      for key in graph:
          for value in graph[key]:
              inverted.setdefault(value, set()).add(key)
      return inverted
  
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 23 for calling a global function with example usage: invert_graph(graph) and returns: inverted