code: def _fix_matplotlib_backend() -> None:
      """Tries to fix a broken matplotlib backend."""
      try:
          backend = matplotlib.get_backend()
      except Exception:  # skipcq:PYL-W0703
          logger.error(
              "Cannot retrieve Matplotlib backend, likely due to a compatibility "
              "issue with system dependencies. Please refer to the documentation: "
              "https://matplotlib.org/stable/tutorials/introductory/usage.html#backends"
          )
          raise
  
      # At first, matplotlib will be initialized with default OS-specific
      # available backend
      if backend == "TkAgg":
          try:
              # on OSX sometimes the tkinter package is broken and can't be imported.
              # we'll try to import it and if it fails we will use a different backend
              import tkinter
          except (ImportError, ModuleNotFoundError):
              logger.debug("Setting matplotlib backend to 'agg'")
              matplotlib.use("agg")
  
      # if no backend is set by default, we'll try to set it up manually
      elif backend is None:  # pragma: no cover
          try:
              # If the `tkinter` package is available, we can use the `TkAgg` backend
              import tkinter  # noqa: F401
  
              logger.debug("Setting matplotlib backend to 'TkAgg'")
              matplotlib.use("TkAgg")
          except (ImportError, ModuleNotFoundError):
              logger.debug("Setting matplotlib backend to 'agg'")
              matplotlib.use("agg")
  
file_path: rasa/rasa/utils/plotting.py
imports: import logging
  import itertools
  import os
  from functools import wraps
  import numpy
  from typing import Any, Callable, List, Optional, Text, TypeVar, Union, Tuple
  import matplotlib
  from matplotlib.ticker import FormatStrFormatter
  import rasa.shared.utils.io
  from rasa.constants import RESULTS_FILE
label_desc: Use image node_id 1 for calling a global function with example usage: _fix_matplotlib_backend() without return types