code: def get_inputs_helper(step, ignore, target):
      
      outputs = set()
      if not ignore and step.target == target:
          outputs.add(step)
  
      if ignore or not step.target:
          for i in step.inputs:
              outputs.update(get_inputs_helper(i, ignore=False, target=target))
  
      return outputs
docs: Recursion helper used by get_inputs()