code: def get_statsd_logger(cls) -> SafeStatsdLogger:
      """Return logger for StatsD."""
      # no need to check for the scheduler/statsd_on -> this method is only called when it is set
      # and previously it would crash with None is callable if it was called without it.
      from statsd import StatsClient
  
      stats_class = conf.getimport(
          "metrics", "statsd_custom_client_path", fallback=None
      )
      if stats_class:
          if not issubclass(stats_class, StatsClient):
              raise AirflowConfigException(
                  "Your custom StatsD client must extend the statsd.StatsClient in order to ensure "
                  "backwards compatibility."
              )
          else:
              log.info("Successfully loaded custom StatsD client")
  
      else:
          stats_class = StatsClient
  
      statsd = stats_class(
          host=conf.get("metrics", "statsd_host"),
          port=conf.getint("metrics", "statsd_port"),
          prefix=conf.get("metrics", "statsd_prefix"),
      )
  
      influxdb_tags_enabled = conf.getboolean(
          "metrics", "statsd_influxdb_enabled", fallback=False
      )
      metric_tags_validator = BlockListValidator(
          conf.get("metrics", "statsd_disabled_tags", fallback=None)
      )
      return SafeStatsdLogger(
          statsd,
          get_validator(),
          influxdb_tags_enabled,
          metric_tags_validator,
      )
  
file_path: airflow/airflow/metrics/statsd_logger.py
imports: from __future__ import annotations
  import logging
  from functools import wraps
  from typing import TYPE_CHECKING, Callable, TypeVar, cast
  from airflow.configuration import conf
  from airflow.exceptions import AirflowConfigException
  from airflow.metrics.protocols import Timer
  from airflow.metrics.validators import AllowListValidator, BlockListValidator, get_validator, validate_stat
label_desc: Use image node_id 2 for calling a global function with example usage: get_statsd_logger(cls) and returns: SafeStatsdLogger