code: def _extract_items(
      obj: object,
      path: Sequence[str],
      *,
      index: int,
      flattened_key: str | None,
  ) -> list[tuple[str, FileTypes]]:
      try:
          key = path[index]
      except IndexError:
          if isinstance(obj, NotGiven):
              # no value was provided - we can safely ignore
              return []
  
          # cyclical import
          from .._files import assert_is_file_content
  
          # We have exhausted the path, return the entry we found.
          assert_is_file_content(obj, key=flattened_key)
          assert flattened_key is not None
          return [(flattened_key, cast(FileTypes, obj))]
  
      index += 1
      if is_dict(obj):
          try:
              # We are at the last entry in the path so we must remove the field
              if (len(path)) == index:
                  item = obj.pop(key)
              else:
                  item = obj[key]
          except KeyError:
              # Key was not present in the dictionary, this is not indicative of an error
              # as the given path may not point to a required field. We also do not want
              # to enforce required fields as the API may differ from the spec in some cases.
              return []
          if flattened_key is None:
              flattened_key = key
          else:
              flattened_key += f"[{key}]"
          return _extract_items(
              item,
              path,
              index=index,
              flattened_key=flattened_key,
          )
      elif is_list(obj):
          if key != "<array>":
              return []
  
          return flatten(
              [
                  _extract_items(
                      item,
                      path,
                      index=index,
                      flattened_key=flattened_key + "[]"
                      if flattened_key is not None
                      else "[]",
                  )
                  for item in obj
              ]
          )
  
      # Something unexpected was passed, just ignore it.
      return []
  
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 3 for calling a global function with example usage: _extract_items(obj, path) and returns: list, _extract_items, list, flatten, list, list, list