code: def check_shared(axs, x_shared, y_shared):
      """
      x_shared and y_shared are n x n boolean matrices; entry (i, j) indicates
      whether the x (or y) axes of subplots i and j should be shared.
      """
      for (
          (i1, ax1),
          (i2, ax2),
          (i3, (name, shared)),
      ) in itertools.product(
          enumerate(axs),
          enumerate(axs),
          enumerate(zip("xy", [x_shared, y_shared])),
      ):
          if i2 <= i1:
              continue
          assert (
              axs[0]._shared_axes[name].joined(ax1, ax2)
              == shared[i1, i2]
          ), "axes %i and %i incorrectly %ssharing %s axis" % (
              i1,
              i2,
              "not " if shared[i1, i2] else "",
              name,
          )
  
imports: import itertools
  import numpy
  import pytest
  from matplotlib.axes import Axes, SubplotBase
  import matplotlib.pyplot
  from matplotlib.testing.decorators import check_figures_equal, image_comparison
label_desc: Use image node_id 1 for calling a global function with example usage: check_shared(axs, x_shared, y_shared) without return types