code: def from_networkx(G_input, undirected=True):
      G = Graph()
  
      for idx, x in enumerate(G_input.nodes()):
          for y in iterkeys(G_input[x]):
              G[x].append(y)
  
      if undirected:
          G.make_undirected()
  
      return G
  
imports: import logging
  import sys
  from io import open
  from os import path
  from time import time
  from glob import glob
  from six.moves import range, zip, zip_longest
  from six import iterkeys
  from collections import defaultdict, Iterable
  import random
  from random import shuffle
  from itertools import product, permutations
  from scipy.io import loadmat
  from scipy.sparse import issparse
label_desc: Use image node_id 10 for calling a global function with example usage: from_networkx(G_input, undirected) and returns: G