code: def convert_affinity(affinity) -> k8s.V1Affinity:
      """Convert a dict into an k8s.V1Affinity."""
      return _convert_from_dict(affinity, k8s.V1Affinity)
  
file_path: airflow/airflow/providers/cncf/kubernetes/backcompat/backwards_compat_converters.py
imports: from __future__ import annotations
  from kubernetes.client import ApiClient, models
  from airflow.exceptions import AirflowException
label_desc: Use image node_id 10 for calling a global function with example usage: convert_affinity(affinity) and returns: _convert_from_dict