def find_join_source(clauses, join_to):
 selectables = list(_from_objects(join_to))
 for (i, f) in enumerate(clauses):
  for s in selectables:
   if f.is_derived_from(s):
    return (i, f)
 else:
  return (None, None)

def find_join_source ( clauses , join_to ) : selectables = list ( _from_objects ( join_to ) ) for ( i , f ) in enumerate ( clauses ) : for s in selectables : if f . is_derived_from ( s ) : return ( i , f ) else : return ( None , None )
given a list of from clauses and a selectable .