def index_level_name(index, i):
    """Return the name of an index level or a default name if `index.name` is
    None.

    Parameters
    ----------
    index : pandas.Index
    i : int

    Returns
    -------
    name : str
    """
    if index.name is not None:
        return index.name
    else:
        return '__index_level_{:d}__'.format(i)