def _build(config_cls, dictionary, validate=False):  
if not is_config_type(config_cls):<EOL><INDENT>raise ValueError(<EOL>f"<STR_LIT>"<EOL>f"<STR_LIT>"<EOL>)<EOL><DEDENT>if validate:<EOL><INDENT>jsonschema.validate(dictionary, build_schema(config_cls))<EOL><DEDENT>kwargs = {}<EOL>for var in attr.fields(config_cls):<EOL><INDENT>if not is_config_var(var):<EOL><INDENT>continue<EOL><DEDENT>entry = var.metadata[CONFIG_KEY]<EOL>arg_key = entry.name if entry.name else var.name<EOL>arg_default = var.default if var.default is not None else None<EOL>if callable(entry.decoder):<EOL><INDENT>kwargs[var.name] = entry.decoder(dictionary.get(arg_key, arg_default))<EOL>continue<EOL><DEDENT>if is_array_type(entry.type):<EOL><INDENT>if is_typing_type(entry.type) and len(entry.type.__args__) > <NUM_LIT:0>:<EOL><INDENT>nested_type = entry.type.__args__[<NUM_LIT:0>]<EOL>if is_config_type(nested_type):<EOL><INDENT>kwargs[var.name] = [<EOL>_build(nested_type, item)<EOL>for item in dictionary.get(arg_key, [])<EOL>]<EOL><DEDENT>else:<EOL><INDENT>kwargs[var.name] = typecast(entry.type, dictionary.get(arg_key, []))<EOL><DEDENT><DEDENT><DEDENT>elif is_object_type(entry.type):<EOL><INDENT>item = dictionary.get(arg_key, {})<EOL>if is_typing_type(entry.type) and len(entry.type.__args__) == <NUM_LIT:2>:<EOL><INDENT>(_, value_type) = entry.type.__args__<EOL>kwargs[var.name] = {<EOL>key: _build(value_type, value)<EOL>if is_config_type(value_type)<EOL>else typecast(value_type, value)<EOL>for (key, value) in item.items()<EOL>}<EOL><DEDENT>else:<EOL><INDENT>kwargs[var.name] = typecast(entry.type, item)<EOL><DEDENT><DEDENT>elif is_config_type(entry.type):<EOL><INDENT>if arg_key not in dictionary:<EOL><INDENT>if is_config_type(arg_default) and entry.type == arg_default:<EOL><INDENT>kwargs[var.name] = _build(entry.type, {})<EOL><DEDENT>else:<EOL><INDENT>kwargs[var.name] = arg_default<EOL><DEDENT><DEDENT>else:<EOL><INDENT>kwargs[var.name] = _build(<EOL>entry.type, dictionary.get(arg_key, arg_default)<EOL>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if arg_key not in dictionary:<EOL><INDENT>kwargs[var.name] = arg_default<EOL><DEDENT>else:<EOL><INDENT>kwargs[var.name] = typecast(<EOL>entry.type, dictionary.get(arg_key, arg_default)<EOL>)<EOL><DEDENT><DEDENT><DEDENT>return config_cls(**kwargs)<EOL>
Builds an instance of ``config_cls`` using ``dictionary``.

    :param type config_cls: The class to use for building
    :param dict dictionary: The dictionary to use for building ``config_cls``
    :param bool validate: Performs validation before building ``config_cls``,
        defaults to False, optional
    :return: An instance of ``config_cls``
    :rtype: object