from typing import Dict


def format_dynamic_value(template: str, text: str) -> str:
    """Format the given template text for the dynamic value.

    Args:
        template (str): The template text to be formatted
        text (str): The current text fragment that triggered the completion

    Returns:
        str: The formatted text
    """

    formats: Dict[str, str] = {"completion": text}

    result = template
    for format_key, format_value in formats.items():
        try:
            result = result.format(**{format_key: format_value})
        except (ValueError, IndexError):
            pass

    return result