def METHOD_NAME(session_template: BosSessionTemplate) -> str:
    """
    Returns the name of the BOS session template.
    Raises InvalidBosSessionTemplate on error.
    """
    try:
        template_name = session_template["name"]
    except KeyError as exc:
        raise InvalidBosSessionTemplate("No 'name' field found in session template") from exc
    except TypeError as exc:
        raise InvalidBosSessionTemplate(
            f"Session template is of unexpected type: {type(session_template)}") from exc
    if isinstance(template_name, str):
        return template_name
    raise InvalidBosSessionTemplate(
        f"Session template 'name' field is of unexpected type: {type(template_name)}") from exc