code: def get_from_dict_or_env(
      data: Dict[str, Any],
      key: str,
      env_key: str,
      default: Optional[str] = None,
  ) -> str:
      """Get a value from a dictionary or an environment variable."""
      if key in data and data[key]:
          return data[key]
      elif env_key in os.environ and os.environ[env_key]:
          return os.environ[env_key]
      elif default is not None:
          return default
      else:
          raise ValueError(
              f"Did not find {key}, please add an environment variable"
              f" `{env_key}` which contains it, or pass"
              f"  `{key}` as a named parameter."
          )
  
imports: import re
  import os
  from pydantic import BaseModel, Extra, root_validator
  from typing import Any, Callable, Dict, List, Optional, Union, Tuple
  from time import sleep
  from autogen._pydantic import PYDANTIC_V1
  from autogen.agentchat import Agent, UserProxyAgent
  from autogen.code_utils import UNKNOWN, extract_code, execute_code, infer_lang
  from autogen.math_utils import get_answer
label_desc: Use image node_id 4 for calling a global function with example usage: get_from_dict_or_env(data, key, env_key, default) and returns: data, os, default