def generate_yaml_template(base_yaml, slots_proto):
    """
    Args:
        base_yaml: A string representation of one type job's base yaml.
        slots_proto: A proto map object representation of modification
        template's operable smallest units.
    Returns:
        string: A yaml_template
    """
    slots = {}
    for key in slots_proto:
        if slots_proto[key].reference_type == Slot.ReferenceType.DEFAULT:
            slots[key] = slots_proto[key].default
        else:
            slots[key] = f'${{{slots_proto[key].reference}}}'
    return format_yaml(base_yaml, **slots)

    Args:
        base_yaml: A string representation of one type job's base yaml.
        slots_proto: A proto map object representation of modification
        template's operable smallest units.
    Returns:
        string: A yaml_template
    
web_console_v2/api/fedlearner_webconsole/workflow_template/slots_formatter.py