def build_from_config(config, registry, default_args=None):
    """Build a callable object from configuation dict.

    Args:
        config (dict): Configuration dict. It should contain the key "name".
        registry (:obj:`Registry`): The registry to search the name from.
        default_args (dict, optional): Default initialization argments.
    """
    assert isinstance(config, dict) and 'name' in config
    assert isinstance(default_args, dict) or default_args is None

    name = config['name']
    name = name.replace('-', '_')
    obj = registry.get(name)
    if obj is None:
        raise KeyError(f'{name} is not in the {registry.name} registry')

    args = dict()
    if default_args is not None:
        args.update(default_args)
    if 'params' in config:
        args.update(config['params'])
    return obj(**args)