code: def _get_available_interactive_backends():
      _is_linux_and_display_invalid = (
          sys.platform == "linux"
          and not _c_internal_utils.display_is_valid()
      )
      envs = []
      for deps, env in [
          *[
              ([qt_api], {"MPLBACKEND": "qtagg", "QT_API": qt_api})
              for qt_api in ["PyQt6", "PySide6", "PyQt5", "PySide2"]
          ],
          *[
              (
                  [qt_api, "cairocffi"],
                  {"MPLBACKEND": "qtcairo", "QT_API": qt_api},
              )
              for qt_api in ["PyQt6", "PySide6", "PyQt5", "PySide2"]
          ],
          *[
              (
                  ["cairo", "gi"],
                  {"MPLBACKEND": f"gtk{version}{renderer}"},
              )
              for version in [3, 4]
              for renderer in ["agg", "cairo"]
          ],
          (["tkinter"], {"MPLBACKEND": "tkagg"}),
          (["wx"], {"MPLBACKEND": "wx"}),
          (["wx"], {"MPLBACKEND": "wxagg"}),
          (["matplotlib.backends._macosx"], {"MPLBACKEND": "macosx"}),
      ]:
          reason = None
          missing = [
              dep for dep in deps if not importlib.util.find_spec(dep)
          ]
          if _is_linux_and_display_invalid:
              reason = "$DISPLAY and $WAYLAND_DISPLAY are unset"
          elif missing:
              reason = "{} cannot be imported".format(
                  ", ".join(missing)
              )
          elif env["MPLBACKEND"] == "macosx" and os.environ.get(
              "TF_BUILD"
          ):
              reason = "macosx backend fails on Azure"
          elif env["MPLBACKEND"].startswith("gtk"):
              import gi  # type: ignore
  
              version = env["MPLBACKEND"][3]
              repo = gi.Repository.get_default()
              if f"{version}.0" not in repo.enumerate_versions("Gtk"):
                  reason = "no usable GTK bindings"
          marks = []
          if reason:
              marks.append(
                  pytest.mark.skip(
                      reason=f"Skipping {env} because {reason}"
                  )
              )
          elif (
              env["MPLBACKEND"].startswith("wx")
              and sys.platform == "darwin"
          ):
              # ignore on macosx because that's currently broken (github #16849)
              marks.append(pytest.mark.xfail(reason="github #16849"))
          elif (
              env["MPLBACKEND"] == "tkagg"
              and (
                  "TF_BUILD" in os.environ
                  or "GITHUB_ACTION" in os.environ
              )
              and sys.platform == "darwin"
              and sys.version_info[:2] < (3, 11)
          ):
              marks.append(  # https://github.com/actions/setup-python/issues/649
                  pytest.mark.xfail(
                      reason="Tk version mismatch on Azure macOS CI"
                  )
              )
          envs.append(({**env, "BACKEND_DEPS": ",".join(deps)}, marks))
      return envs
  
imports: import functools
  import importlib
  import importlib.util
  import inspect
  import json
  import os
  import platform
  import signal
  import subprocess
  import sys
  import tempfile
  import time
  import urllib.request
  from PIL import Image
  import pytest
  import matplotlib
  from matplotlib import _c_internal_utils
  from matplotlib.backend_tools import ToolToggleBase
  from matplotlib.testing import subprocess_run_helper
label_desc: Use image node_id 1 for calling a global function with example usage: _get_available_interactive_backends() and returns: envs