from contextlib import suppress


def rename_aesthetics(obj):
    """
    Rename aesthetics in obj

    Parameters
    ----------
    obj : dict or list
        Object that contains aesthetics names

    Returns
    -------
    obj : dict or list
        Object that contains aesthetics names
    """
    lookup = {
        'colour': 'color',
        'outlier_colour': 'outlier_color',
    }

    if isinstance(obj, dict):
        for eng, us in lookup.items():
            with suppress(KeyError):
                obj[us] = obj.pop(eng)
    else:
        obj = [lookup[x] if x in lookup else x for x in obj]
    return obj