@classmethod
def _validate_dict_argument(cls, name, value, allowed_keys,
    require_same_keys=False):
    """Check if an argument is an dictionary with correct key set"""
    if value is None:
        return
    if not isinstance(value, dict):
        raise ValueError("Argument '{}' must be a dictionary using {} as keys"
            .format(name, allowed_keys))
    value_keys = sorted(value.keys())
    if require_same_keys:
        if value_keys != allowed_keys:
            raise ValueError("The keys of argument '{}' must be the same as {}"
                .format(name, allowed_keys))
    elif not set(value_keys).issubset(set(allowed_keys)):
        raise ValueError("The keys of argument '{}' must be a subset of {}"
            .format(name, allowed_keys))
