'Return a new :func`.select` construct with redundantly
named, equivalently-valued columns removed from the columns clause.
"Redundant" here means two columns where one refers to the
other either based on foreign key, or via a simple equality
comparison in the WHERE clause of the statement.   The primary purpose
of this method is to automatically construct a select statement
with all uniquely-named columns, without the need to use
table-qualified labels as :meth:`.apply_labels` does.
When columns are omitted based on foreign key, the referred-to
column is the one that\'s kept.  When columns are omitted based on
WHERE eqivalence, the first column in the columns clause is the
one that\'s kept.
:param only_synonyms: when True, limit the removal of columns
to those which have the same name as the equivalent.   Otherwise,
all columns that are equivalent to another are removed.
.. versionadded:: 0.8'

@util.dependencies('sqlalchemy.sql.util')
def reduce_columns(self, sqlutil, only_synonyms=True):

    return self.with_only_columns(sqlutil.reduce_columns(self.inner_columns, only_synonyms=only_synonyms, *((self._whereclause,) + tuple(self._from_obj))))
