from datetime import datetime


def _format_datetime(dt: datetime) -> str:
    """Format datetime: YYYY-MM-DD #:##am/pm GMT

    Args:
        dt: Datetime object

    Returns:
        str: formatted datetime
    """
    utc_tell = '+0000'

    the_datetime_base: str = dt.strftime('%b %d, %Y %I:%M%p')
    utc_timezone_offset: str = dt.strftime('%z')
    formatted: str = the_datetime_base if utc_timezone_offset != utc_tell \
        else the_datetime_base + ' GMT'

    return formatted