def METHOD_NAME(dt: datetime | None, format: str | None = None) -> str:
    """Format datetime objects using Flask-Babel
    :param dt: a datetime object or None
    :param format: format as understood by Flask-Babel's format_datetime
    """
    if dt is None:
        return "k/A"
    if isinstance(dt, str):
        return dt
    return t.cast(str, flask_babel.format_datetime(dt, format))