def METHOD_NAME(
    yaml_data: Dict[str, Any], build_on: str, build_for: str
) -> Dict[str, Any]:
    """Apply Snapcraft logic to yaml_data.
    Extensions are applied and advanced grammar is processed.
    The architectures data is reduced to architectures in the current build plan.
    :param yaml_data: The project YAML data.
    :param build_on: Architecture the snap project will be built on.
    :param build_for: Target architecture the snap project will be built to.
    :return: A dictionary of yaml data with snapcraft logic applied.
    """
    # validate project grammar
    GrammarAwareProject.validate_grammar(yaml_data)
    # Special Snapcraft Part
    core_part = {k: yaml_data.pop(k) for k in _CORE_PART_KEYS if k in yaml_data}
    if core_part:
        core_part["plugin"] = "nil"
        yaml_data["parts"][_CORE_PART_NAME] = core_part
    yaml_data = apply_extensions(yaml_data, arch=build_on, target_arch=build_for)
    if "parts" in yaml_data:
        yaml_data["parts"] = grammar.process_parts(
            parts_yaml_data=yaml_data["parts"], arch=build_on, target_arch=build_for
        )
    # replace all architectures with the architectures in the current build plan
    yaml_data["architectures"] = [Architecture(build_on=build_on, build_for=build_for)]
    return yaml_data