def METHOD_NAME(pair):
    """
    Returns True if a depends on b.
    """
    a, b = pair
    return any(bout in a.inputs for bout in b.outputs) or any(
        METHOD_NAME((ainp.owner, b)) for ainp in a.inputs if ainp.owner
    )