code: def convert_env_vars(env_vars) -> list[k8s.V1EnvVar]:
      """
      Converts a dictionary of key:value into a list of env_vars.
  
      :param env_vars:
      :return:
      """
      if isinstance(env_vars, dict):
          res = []
          for k, v in env_vars.items():
              res.append(k8s.V1EnvVar(name=k, value=v))
          return res
      elif isinstance(env_vars, list):
          if all([isinstance(e, k8s.V1EnvVar) for e in env_vars]):
              return env_vars
      raise AirflowException(
          f"Expected dict or list of V1EnvVar, got {type(env_vars)}"
      )
  
imports: from __future__ import annotations
  from kubernetes.client import models
  from airflow.exceptions import AirflowException
label_desc: Use image node_id 1 for calling a global function with example usage: convert_env_vars(env_vars) and returns: res, env_vars