code: def import_metrics_handler(
      module_name: str, handler_name: str
  ) -> type[RequestHandler]:
      """Import ``handler_name`` from ``module_name`` if ``prometheus_client``
      is installed, import the ``PrometheusNotAvailableHandler`` otherwise.
      """
      try:
          import prometheus_client  # noqa: F401
      except ModuleNotFoundError:
          return PrometheusNotAvailableHandler
      module = import_module(module_name)
      handler = getattr(module, handler_name)
      assert issubclass(handler, RequestHandler)
      return handler
  
file_path: distributed/distributed/http/prometheus.py
imports: from __future__ import annotations
  from importlib import import_module
  import dask.config
  from distributed.http.utils import RequestHandler
label_desc: Use image node_id 1 for calling a global function with example usage: import_metrics_handler(module_name, handler_name) and returns: handler, PrometheusNotAvailableHandler