code: def mbox_graph():
      mbox = mailbox.mbox("unix_email.mbox")  # parse unix mailbox
  
      G = nx.MultiDiGraph()  # create empty graph
  
      # parse each messages and build graph
      for msg in mbox:  # msg is python email.Message.Message object
          (source_name, source_addr) = parseaddr(msg["From"])  # sender
          # get all recipients
          # see https://docs.python.org/3/library/email.html
          tos = msg.get_all("to", [])
          ccs = msg.get_all("cc", [])
          resent_tos = msg.get_all("resent-to", [])
          resent_ccs = msg.get_all("resent-cc", [])
          all_recipients = getaddresses(
              tos + ccs + resent_tos + resent_ccs
          )
          # now add the edges for this mail message
          for target_name, target_addr in all_recipients:
              G.add_edge(source_addr, target_addr, message=msg)
  
      return G
  
imports: from email.utils import getaddresses, parseaddr
  import mailbox
  import matplotlib.pyplot
  import networkx
label_desc: Use image node_id 1 for calling a global function with example usage: mbox_graph() and returns: G