code: def mixing_dict(xy, normalized=False):
      """Returns a dictionary representation of mixing matrix.
  
      Parameters
      ----------
      xy : list or container of two-tuples
         Pairs of (x,y) items.
  
      attribute : string
         Node attribute key
  
      normalized : bool (default=False)
         Return counts if False or probabilities if True.
  
      Returns
      -------
      d: dictionary
         Counts or Joint probability of occurrence of values in xy.
      """
      d = {}
      psum = 0.0
      for x, y in xy:
          if x not in d:
              d[x] = {}
          if y not in d:
              d[y] = {}
          v = d[x].get(y, 0)
          d[x][y] = v + 1
          psum += 1
  
      if normalized:
          for _, jdict in d.items():
              for j in jdict:
                  jdict[j] /= psum
      return d
  
file_path: networkx/networkx/algorithms/assortativity/mixing.py
imports: import networkx
  from networkx.algorithms.assortativity.pairs import node_attribute_xy, node_degree_xy
  from networkx.utils import dict_to_numpy_array
label_desc: Use image node_id 5 for calling a global function with example usage: mixing_dict(xy, normalized) and returns: d