def format_yaml(yaml, **kwargs):
    """Formats a yaml template.

    Example usage:
        format_yaml('{"abc": ${x.y}}', x={'y': 123})
    output should be  '{"abc": 123}'
    """
    template = _YamlTemplateOnlyFillWorkflow(yaml)
    try:
        # checkout whether variables which can be observed at workflow_template
        # module is consistent with placeholders in string
        format_workflow = template.substitute(flatten(kwargs or {},
                                           reducer='dot'))
    except KeyError as e:
        raise ValueError(
            f'Unknown placeholder: {e.args[0]}') from e
    template = _YamlTemplateFillAll(format_workflow)
    try:
        # checkout whether other placeholders are valid and
        # format them with {} in order to go ahead to next step,
        # json format check
        return template.substitute(flatten(kwargs or {},
                                               reducer='dot'))
    except ValueError as e:
        raise ValueError(f'Wrong placeholder: {str(e)} . '
                         f'Origin yaml: {format_workflow}')
Formats a yaml template.

    Example usage:
        format_yaml('{"abc": ${x.y}}', x={'y': 123})
    output should be  '{"abc": 123}'
    
web_console_v2/api/fedlearner_webconsole/workflow_template/template_validaor.py