code: def mpl_test_settings(request):
      from matplotlib.testing.decorators import _do_cleanup
  
      original_units_registry = matplotlib.units.registry.copy()
      original_settings = matplotlib.rcParams.copy()
  
      backend = None
      backend_marker = request.node.get_closest_marker("backend")
      if backend_marker is not None:
          assert (
              len(backend_marker.args) == 1
          ), "Marker 'backend' must specify 1 backend."
          (backend,) = backend_marker.args
          prev_backend = matplotlib.get_backend()
  
      style = "_classic_test"  # Default of cleanup and image_comparison too.
      style_marker = request.node.get_closest_marker("style")
      if style_marker is not None:
          assert (
              len(style_marker.args) == 1
          ), "Marker 'style' must specify 1 style."
          (style,) = style_marker.args
  
      matplotlib.testing.setup()
      if backend is not None:
          # This import must come after setup() so it doesn't load the default
          # backend prematurely.
          import matplotlib.pyplot as plt
  
          plt.switch_backend(backend)
      matplotlib.style.use(style)
      try:
          yield
      finally:
          if backend is not None:
              plt.switch_backend(prev_backend)
          _do_cleanup(original_units_registry, original_settings)
  
file_path: catboost/contrib/python/matplotlib/py2/matplotlib/testing/conftest.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import pytest
  import matplotlib
label_desc: Use image node_id 3 for calling a global function with example usage: mpl_test_settings(request) without return types