code: def add_xcom_sidecar(
      pod: k8s.V1Pod,
      *,
      sidecar_container_image: str | None = None,
      sidecar_container_resources: k8s.V1ResourceRequirements
      | dict
      | None = None,
  ) -> k8s.V1Pod:
      """Add sidecar."""
      pod_cp = copy.deepcopy(pod)
      pod_cp.spec.volumes = pod.spec.volumes or []
      pod_cp.spec.volumes.insert(0, PodDefaults.VOLUME)
      pod_cp.spec.containers[0].volume_mounts = (
          pod_cp.spec.containers[0].volume_mounts or []
      )
      pod_cp.spec.containers[0].volume_mounts.insert(
          0, PodDefaults.VOLUME_MOUNT
      )
      sidecar = copy.deepcopy(PodDefaults.SIDECAR_CONTAINER)
      sidecar.image = (
          sidecar_container_image or PodDefaults.SIDECAR_CONTAINER.image
      )
      if sidecar_container_resources:
          sidecar.resources = sidecar_container_resources
      pod_cp.spec.containers.append(sidecar)
  
      return pod_cp
  
imports: from __future__ import annotations
  import copy
  from kubernetes.client import models
label_desc: Use image node_id 1 for calling a global function with example usage: add_xcom_sidecar(pod) and returns: pod_cp