code: def get_custom_facets(
      task_instance: TaskInstance | None = None,
  ) -> dict[str, Any]:
      custom_facets = {}
      # check for -1 comes from SmartSensor compatibility with dynamic task mapping
      # this comes from Airflow code
      if (
          hasattr(task_instance, "map_index")
          and getattr(task_instance, "map_index") != -1
      ):
          custom_facets[
              "airflow_mappedTask"
          ] = AirflowMappedTaskRunFacet.from_task_instance(
              task_instance
          )
      return custom_facets
  
imports: from __future__ import annotations
  import datetime
  import json
  import logging
  import os
  from contextlib import suppress
  from functools import wraps
  from typing import TYPE_CHECKING, Any, Iterable
  from urllib.parse import parse_qsl, urlencode, urlparse, urlunparse
  import attrs
  from attrs import asdict
  from openlineage.client.utils import RedactMixin
  from airflow.compat.functools import cache
  from airflow.configuration import conf
  from airflow.providers.openlineage.plugins.facets import AirflowMappedTaskRunFacet, AirflowRunFacet
  from airflow.utils.context import AirflowContextDeprecationWarning
  from airflow.utils.log.secrets_masker import Redactable, Redacted, SecretsMasker, should_hide_value_for_key
label_desc: Use image node_id 8 for calling a global function with example usage: get_custom_facets(task_instance) and returns: custom_facets