code: def test_given_colors_levels_and_extends(split_collections):
      # Remove this line when this test image is regenerated.
      plt.rcParams["pcolormesh.snap"] = False
  
      _, axs = plt.subplots(2, 4)
  
      data = np.arange(12).reshape(3, 4)
  
      colors = ["red", "yellow", "pink", "blue", "black"]
      levels = [2, 4, 8, 10]
  
      for i, ax in enumerate(axs.flat):
          filled = i % 2 == 0.0
          extend = ["neither", "min", "max", "both"][i // 2]
  
          if filled:
              # If filled, we have 3 colors with no extension,
              # 4 colors with one extension, and 5 colors with both extensions
              first_color = 1 if extend in ["max", "neither"] else None
              last_color = -1 if extend in ["min", "neither"] else None
              c = ax.contourf(
                  data,
                  colors=colors[first_color:last_color],
                  levels=levels,
                  extend=extend,
              )
          else:
              # If not filled, we have 4 levels and 4 colors
              c = ax.contour(
                  data, colors=colors[:-1], levels=levels, extend=extend
              )
  
          plt.colorbar(c, ax=ax)
  
      _maybe_split_collections(split_collections)
  
imports: import datetime
  import platform
  import re
  from unittest import mock
  import contourpy
  import numpy
  from numpy.testing import assert_array_almost_equal, assert_array_almost_equal_nulp, assert_array_equal
  import matplotlib
  from matplotlib import pyplot, rc_context, ticker
  from matplotlib.colors import LogNorm, same_color
  import matplotlib.patches
  from matplotlib.testing.decorators import check_figures_equal, image_comparison
  import pytest
label_desc: Use image node_id 11 for calling a global function with example usage: test_given_colors_levels_and_extends(split_collections) without return types