'Given a :class:`.ColumnElement`, return the exported
:class:`.ColumnElement` object from this :class:`.Selectable`
which corresponds to that original
:class:`~sqlalchemy.schema.Column` via a common ancestor
column.
:param column: the target :class:`.ColumnElement` to be matched
:param require_embedded: only return corresponding columns for
the given :class:`.ColumnElement`, if the given :class:`.ColumnElement`
is actually present within a sub-element
of this :class:`.FromClause`.  Normally the column will match if
it merely shares a common ancestor with one of the exported
columns of this :class:`.FromClause`.'

def corresponding_column(self, column, require_embedded=False):

    def embedded(expanded_proxy_set, target_set):
        for t in target_set.difference(expanded_proxy_set):
            if (not set(_expand_cloned([t])).intersection(expanded_proxy_set)):
                return False
        return True
    if self.c.contains_column(column):
        return column
    (col, intersect) = (None, None)
    target_set = column.proxy_set
    cols = self.c._all_columns
    for c in cols:
        expanded_proxy_set = set(_expand_cloned(c.proxy_set))
        i = target_set.intersection(expanded_proxy_set)
        if (i and ((not require_embedded) or embedded(expanded_proxy_set, target_set))):
            if (col is None):
                (col, intersect) = (c, i)
            elif (len(i) > len(intersect)):
                (col, intersect) = (c, i)
            elif (i == intersect):
                col_distance = util.reduce(operator.add, [sc._annotations.get('weight', 1) for sc in col.proxy_set if sc.shares_lineage(column)])
                c_distance = util.reduce(operator.add, [sc._annotations.get('weight', 1) for sc in c.proxy_set if sc.shares_lineage(column)])
                if (c_distance < col_distance):
                    (col, intersect) = (c, i)
    return col
