code: def import_all_classes(
      walkable_paths_and_prefixes: dict[str, str],
      prefix: str,
      provider_ids: list[str] | None = None,
      print_imports: bool = False,
      print_skips: bool = False,
  ) -> tuple[list[str], list[str]]:
      """Imports all classes in providers packages.
  
      This method loads and imports all the classes found in providers, so that we
      can find all the subclasses of operators/sensors etc.
  
      :param walkable_paths_and_prefixes: dict of paths with accompanying prefixes
          to look the provider packages in
      :param prefix: prefix to add
      :param provider_ids - provider ids that should be loaded.
      :param print_imports - if imported class should also be printed in output
      :param print_skips - if skipped classes should also be printed in output
      :return: tuple of list of all imported classes and
      """
      console.print()
      console.print(
          f"Walking all package with prefixes in {walkable_paths_and_prefixes}"
      )
      console.print()
      imported_classes = []
      classes_with_potential_circular_import = []
      tracebacks: list[tuple[str, str]] = []
      printed_packages: set[str] = set()
  
      def mk_prefix(provider_id):
          return f"{prefix}{provider_id}"
  
      if provider_ids:
          provider_prefixes = tuple(
              mk_prefix(provider_id) for provider_id in provider_ids
          )
      else:
          provider_prefixes = (prefix,)
  
      def onerror(_):
          nonlocal tracebacks
          exception_string = traceback.format_exc()
          for provider_prefix in provider_prefixes:
              if provider_prefix in exception_string:
                  start_index = exception_string.find(provider_prefix)
                  end_index = exception_string.find(
                      "\n", start_index + len(provider_prefix)
                  )
                  package = exception_string[start_index:end_index]
                  tracebacks.append((package, exception_string))
                  break
  
      for path, prefix in walkable_paths_and_prefixes.items():
          for modinfo in pkgutil.walk_packages(
              path=[path], prefix=prefix, onerror=onerror
          ):
              if not modinfo.name.startswith(provider_prefixes):
                  if print_skips:
                      console.print(f"Skipping module: {modinfo.name}")
                  continue
              if print_imports:
                  package_to_print = modinfo.name.rpartition(".")[0]
                  if package_to_print not in printed_packages:
                      printed_packages.add(package_to_print)
                      console.print(
                          f"Importing package: {package_to_print}"
                      )
              try:
                  with warnings.catch_warnings(record=True):
                      warnings.filterwarnings(
                          "always", category=DeprecationWarning
                      )
                      _module = importlib.import_module(modinfo.name)
                      for attribute_name in dir(_module):
                          class_name = (
                              modinfo.name + "." + attribute_name
                          )
                          attribute = getattr(_module, attribute_name)
                          if isclass(attribute):
                              imported_classes.append(class_name)
                          if isclass(attribute) and (
                              issubclass(attribute, logging.Handler)
                              or issubclass(
                                  attribute, BaseSecretsBackend
                              )
                          ):
                              classes_with_potential_circular_import.append(
                                  class_name
                              )
              except AirflowOptionalProviderFeatureException:
                  # We ignore optional features
                  ...
              except Exception as e:
                  # skip the check as we are temporary vendoring in the google ads client with wrong package
                  if (
                      "No module named 'google.ads.googleads.v12'"
                      not in str(e)
                  ):
                      exception_str = traceback.format_exc()
                      tracebacks.append((modinfo.name, exception_str))
      if tracebacks:
          if IS_AIRFLOW_VERSION_PROVIDED:
              console.print(
                  f"""
  [red]ERROR: There were some import errors[/]
  
  [yellow]Detected that this job is about installing providers in {USE_AIRFLOW_VERSION}[/],
  [yellow]most likely you are using features that are not available in Airflow {USE_AIRFLOW_VERSION}[/]
  [yellow]and you must implement them in backwards-compatible way![/]
  
  """,
              )
          console.print(
              "[red]----------------------------------------[/]"
          )
          for package, trace in tracebacks:
              console.print(f"Exception when importing: {package}\n\n")
              console.print(trace)
              console.print(
                  "[red]----------------------------------------[/]"
              )
          sys.exit(1)
      else:
          return (
              imported_classes,
              classes_with_potential_circular_import,
          )
  
imports: from __future__ import annotations
  import importlib
  import json
  import logging
  import os
  import pkgutil
  import re
  import subprocess
  import sys
  import traceback
  import warnings
  from enum import Enum
  from inspect import isclass
  from pathlib import Path
  from typing import NamedTuple
  from rich.console import Console
  from airflow.exceptions import AirflowOptionalProviderFeatureException
  from airflow.secrets import BaseSecretsBackend
label_desc: Use image node_id 2 for calling a global function with example usage: import_all_classes(walkable_paths_and_prefixes, prefix, provider_ids, print_imports, print_skips) and returns: prefix, provider_id, imported_classes,  classes_with_potential_circular_import