def mapping_inverse(mapping):
    """Inverses mapping if it is bijective or raises error if not."""
    if len(set(mapping.keys())) != len(set(mapping.values())):
        raise ValueError(f"Mapping {mapping} cannot be reversed, it is not bijective.")
    return dict(zip(mapping.values(), mapping.keys()))