code: def get_required_header(headers: HeadersLike, header: str) -> str:
      lower_header = header.lower()
      if isinstance(headers, Mapping):
          headers = cast(Headers, headers)
          for k, v in headers.items():
              if k.lower() == lower_header and isinstance(v, str):
                  return v
  
      """ to deal with the case where the header looks like Stainless-Event-Id """
      intercaps_header = re.sub(
          r"([^\w])(\w)",
          lambda pat: pat.group(1) + pat.group(2).upper(),
          header.capitalize(),
      )
  
      for normalized_header in [
          header,
          lower_header,
          header.upper(),
          intercaps_header,
      ]:
          value = headers.get(normalized_header)
          if value:
              return value
  
      raise ValueError(f"Could not find {header} header")
  
imports: from __future__ import annotations
  import os
  import re
  import inspect
  import functools
  from typing import Any, Tuple, Mapping, TypeVar, Callable, Iterable, Sequence, cast, overload
  from pathlib import Path
  from typing_extensions import TypeGuard
  import sniffio
  from .._types import Headers, NotGiven, FileTypes, NotGivenOr, HeadersLike
  from .._compat import parse_date, parse_datetime
label_desc: Use image node_id 30 for calling a global function with example usage: get_required_header(headers, header) and returns: value, v