code: def _step_requires_iterator(
      step_func: Callable[[State, T], object]
  ) -> bool:
      """
      Helper function to evaluate whether the get_next_X_batch method should pass the data iterator to the `X_step`
      functions, or whether get_next_X_batch should call `next(data_iter)` and pass a single batch to the step method.
  
      This is closely tied to the Unit's corresponding step function signature.
      """
      argspec = inspect.getfullargspec(step_func)
      annotations = argspec.annotations
      if "data" not in annotations:
          _logger.warning(
              f"Expected step function to have an annotated argument named ``data``. Found {annotations}."
          )
          return False
      annotated_type = annotations["data"]
      return (
          typing_extensions.get_origin(annotated_type)
          is collections.abc.Iterator
      )
  
file_path: tnt/torchtnt/framework/_unit_utils.py
imports: import collections
  import inspect
  import logging
  from typing import Callable, Dict, List, Tuple, TypeVar
  import torch
  import typing_extensions
  from torchtnt.framework.state import State
label_desc: Use image node_id 1 for calling a global function with example usage: _step_requires_iterator(step_func) and returns: unknown, False