def update_indexes(catalog, indexes={}):
    """
    Setup indexes in the catalog.

    Any index in indexes that does not exist in the catalog will be added to it
    Any index in the catalog that is not in indexes will be removed from it
    """
    added = []
    removed = []
    # add indexes
    for name, index in indexes.items():
        if name not in catalog:
            added.append(name)
            catalog[name] = index
    # remove indexes
    for name in list(catalog.keys()):
        if name not in indexes:
            removed.append(name)
            del catalog[name]
    return {'added': added, 'removed': removed}