code: def all_neighbors(graph, node):
      """Returns all of the neighbors of a node in the graph.
  
      If the graph is directed returns predecessors as well as successors.
  
      Parameters
      ----------
      graph : NetworkX graph
          Graph to find neighbors.
  
      node : node
          The node whose neighbors will be returned.
  
      Returns
      -------
      neighbors : iterator
          Iterator of neighbors
      """
      if graph.is_directed():
          values = chain(
              graph.predecessors(node), graph.successors(node)
          )
      else:
          values = graph.neighbors(node)
      return values
  
imports: from collections import Counter
  from itertools import chain
  import networkx
  from networkx.utils import not_implemented_for, pairwise
label_desc: Use image node_id 27 for calling a global function with example usage: all_neighbors(graph, node) and returns: values