Given a dict containing an entry "module" which contains a FSProvider identifier, parse the configuration and returns a fs_provider.
        Exits if there is an error.

def filesystem_from_config_dict(config_fs):
    """ Given a dict containing an entry "module" which contains a FSProvider identifier, parse the configuration and returns a fs_provider.
        Exits if there is an error.
    """
    if "module" not in config_fs:
        print("Key 'module' should be defined for the filesystem provider ('fs' configuration option)", file=sys.stderr)
        exit(1)

    filesystem_providers = get_filesystems_providers()
    if config_fs["module"] not in filesystem_providers:
        print("Unknown filesystem provider "+config_fs["module"], file=sys.stderr)
        exit(1)

    fs_class = filesystem_providers[config_fs["module"]]
    fs_args_needed = fs_class.get_needed_args()

    fs_args = {}
    for arg_name, (arg_type, arg_required, _) in fs_args_needed.items():
        if arg_name in config_fs:
            fs_args[arg_name] = arg_type(config_fs[arg_name])
        elif arg_required:
            print("fs option {} is required".format(arg_name), file=sys.stderr)
            exit(1)

    try:
        return fs_class.init_from_args(**fs_args)
    except:
        print("Unable to load class " + config_fs["module"], file=sys.stderr)
        raise