Recursion helper used by get_inputs()

def get_inputs_helper(step, ignore, target):
    """
    Recursion helper used by get_inputs()
    """
    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