'produce labeled columns present in a select().'

def _label_select_column(self, select, column, populate_result_map, asfrom, column_clause_args, name=None, within_columns_clause=True):

    if (column.type._has_column_expression and populate_result_map):
        col_expr = column.type.column_expression(column)
        add_to_result_map = (lambda keyname, name, objects, type_: self._add_to_result_map(keyname, name, (objects + (column,)), type_))
    else:
        col_expr = column
        if populate_result_map:
            add_to_result_map = self._add_to_result_map
        else:
            add_to_result_map = None
    if (not within_columns_clause):
        result_expr = col_expr
    elif isinstance(column, elements.Label):
        if (col_expr is not column):
            result_expr = _CompileLabel(col_expr, column.name, alt_names=(column.element,))
        else:
            result_expr = col_expr
    elif ((select is not None) and name):
        result_expr = _CompileLabel(col_expr, name, alt_names=(column._key_label,))
    elif (asfrom and isinstance(column, elements.ColumnClause) and (not column.is_literal) and (column.table is not None) and (not isinstance(column.table, selectable.Select))):
        result_expr = _CompileLabel(col_expr, elements._as_truncated(column.name), alt_names=(column.key,))
    elif ((not isinstance(column, (elements.UnaryExpression, elements.TextClause))) and ((not hasattr(column, 'name')) or isinstance(column, functions.Function))):
        result_expr = _CompileLabel(col_expr, column.anon_label)
    elif (col_expr is not column):
        result_expr = _CompileLabel(col_expr, elements._as_truncated(column.name), alt_names=(column.key,))
    else:
        result_expr = col_expr
    column_clause_args.update(within_columns_clause=within_columns_clause, add_to_result_map=add_to_result_map)
    return result_expr._compiler_dispatch(self, **column_clause_args)
