def validate_config(config):
    """Validate the structure and required keys of a config dict.
    This is intended to raise a user-readable error message if a
    configuration problem exists.

    Raise ValueError if config is not a dict.
    Raise ValueError if config is missing "bucket" value.
    """
    if not isinstance(config, dict):
        raise ValueError('Config root must be a dictionary.')
    if 'bucket' not in config:
        raise ValueError('Config is missing required "bucket" value.')
