code: def matmul2d(A, B):
      """Multiplication for 2D matrices.
  
      Parameters
      ----------
      A
      B
  
      Examples
      --------
  
      >>> import pprint
      >>> from river import utils
  
      >>> A = {
      ...     (0, 0): 2, (0, 1): 0, (0, 2): 4,
      ...     (1, 0): 5, (1, 1): 6, (1, 2): 0
      ... }
  
      >>> B = {
      ...     (0, 0): 1, (0, 1): 1, (0, 2): 0, (0, 3): 0,
      ...     (1, 0): 2, (1, 1): 0, (1, 2): 1, (1, 3): 3,
      ...     (2, 0): 4, (2, 1): 0, (2, 2): 0, (2, 3): 0
      ... }
  
      >>> C = utils.math.matmul2d(A, B)
      >>> pprint.pprint(C)
      {(0, 0): 18.0,
          (0, 1): 2.0,
          (0, 2): 0.0,
          (0, 3): 0.0,
          (1, 0): 17.0,
          (1, 1): 5.0,
          (1, 2): 6.0,
          (1, 3): 18.0}
  
      """
      C = {}
  
      for ((i, k1), x), ((k2, j), y) in itertools.product(
          A.items(), B.items()
      ):
          if k1 != k2:
              continue
          C[i, j] = C.get((i, j), 0.0) + x * y
  
      return C
  
imports: from __future__ import annotations
  import functools
  import itertools
  import math
  import operator
  import numpy
  import scipy
label_desc: Use image node_id 2 for calling a global function with example usage: matmul2d(A, B) and returns: C