code: def flat_transforms_recursive(
      transforms: Union[List, Any], position: int
  ) -> List[Any]:
      """
      Flattens a list of transformations.
  
      :param transforms: The list of transformations to flatten.
      :param position: The position of the transformed element.
      :return: A flat list of transformations.
      """
      if not isinstance(transforms, Iterable):
          transforms = [transforms]
  
      must_flat = True
      while must_flat:
          must_flat = False
          flattened_list = []
  
          for transform in transforms:
              flat_strat = getattr(transform, "flat_transforms", None)
              if callable(flat_strat):
                  flattened_list.extend(flat_strat(position))
                  must_flat = True
              elif isinstance(transform, Compose):
                  flattened_list.extend(transform.transforms)
                  must_flat = True
              elif isinstance(transform, Sequence):
                  flattened_list.extend(transform)
                  must_flat = True
              elif transform is None:
                  pass
              else:
                  flattened_list.append(transform)
  
          transforms = flattened_list
  
      return transforms
  
imports: from abc import ABC, abstractmethod
  import warnings
  from typing import Any, Callable, Iterable, List, Sequence, Tuple, Union
  from inspect import signature, Parameter
  from torchvision.transforms import Compose
label_desc: Use image node_id 1 for calling a global function with example usage: flat_transforms_recursive(transforms, position) and returns: transforms