human
Here's a good function header given the following:
I wrote the below code

    colnames = util.OrderedSet()
    colnamemaps = {}
    types = {}
    for key in table_map:
        table = table_map[key]
        if isinstance(table, sql.Select):
            table = table.alias()
            table_map[key] = table
        m = {}
        for c in table.c:
            colnames.add(c.key)
            m[c.key] = c
            types[c.key] = c.type
        colnamemaps[table] = m
    def col(name, table):
        try:
            return colnamemaps[table][name]
        except KeyError:
            if cast_nulls:
                return sql.cast(sql.null(), types[name]).label(name)
            else:
                return sql.type_coerce(sql.null(), types[name]).label(name)
    result = []
    for (type, table) in table_map.items():
        if (typecolname is not None):
            result.append(sql.select(([col(name, table) for name in colnames] + [sql.literal_column(sql_util._quote_ddl_expr(type)).label(typecolname)]), from_obj=[table]))
        else:
            result.append(sql.select([col(name, table) for name in colnames], from_obj=[table]))
    return sql.union_all(*result).alias(aliasname)

What's a good function header?
assistant
#Here's a good function header.

def polymorphic_union(table_map, typecolname, aliasname='p_union', cast_nulls=True):