def ancestors(variable_list, blockers=None):
 def expand(r):
  if (r.owner and ((not blockers) or (r not in blockers))):
   return reversed(r.owner.inputs)
 dfs_variables = stack_search(deque(variable_list), expand, 'dfs')
 return dfs_variables

def ancestors ( variable_list , blockers = None ) : def expand ( r ) : if ( r . owner and ( ( not blockers ) or ( r not in blockers ) ) ) : return reversed ( r . owner . inputs ) dfs_variables = stack_search ( deque ( variable_list ) , expand , 'dfs' ) return dfs_variables
return the variables that contribute to those in variable_list .