def index_columns(df, none_name=None):
    """Return list of column names that form the (multi-)index or None, if index is a single unnamed
    column."""
    try:
        return [l.name for l in df.index.levels]
    except AttributeError:
        name = df.index.name
        if name is not None:
            return [name]
        elif none_name is not None:
            return [none_name]