class_docstr: Main class from which all Flows should inherit.
  
  Attributes
  ----------
  index
  input
code: def _find_input(self, stack_index=None):
      if stack_index is None:
          stack_index = len(self._foreach_stack) - 1
  
      if stack_index in self._cached_input:
          return self._cached_input[stack_index]
      elif self._foreach_stack:
          # NOTE this is obviously an O(n) operation which also requires
          # downloading the whole input data object in order to find the
          # right split. One can override this method with a more efficient
          # input data handler if this is a problem.
          frame = self._foreach_stack[stack_index]
          try:
              var = getattr(self, frame.var)
          except AttributeError:
              # this is where AttributeError happens:
              # [ foreach x ]
              #   [ foreach y ]
              #     [ inner ]
              #   [ join y ] <- call self.foreach_stack here,
              #                 self.x is not available
              self._cached_input[stack_index] = None
          else:
              try:
                  self._cached_input[stack_index] = var[frame.index]
              except TypeError:
                  # __getitem__ not supported, fall back to an iterator
                  self._cached_input[stack_index] = next(
                      islice(var, frame.index, frame.index + 1)
                  )
          return self._cached_input[stack_index]
  
imports: import inspect
  import os
  import sys
  import traceback
  from itertools import islice
  from types import FunctionType, MethodType
  from typing import Any, Callable, List, Optional, Tuple
  from .None import cmd_with_io
  from .parameters import DelayedEvaluationParameter, Parameter
  from .exception import MetaflowException, MissingInMergeArtifactsException, UnhandledInMergeArtifactsException
  from .graph import FlowGraph
  from .unbounded_foreach import UnboundedForeachInput
  from .datastore.inputs import Inputs
label_desc: Use image node_id 12 for calling the FlowSpec obj's underlying member method code with example usage: obj._find_input(stack_index) and returns: self, self