from datetime import datetime
import logging


def date_after(tweet: dict, date: datetime):
    """Return True if passed tweet was posted after the passed date.

    :param tweet:  JSON dict for tweet
    :param date:  if the tweet was posted after this date it should be considered for deletion
    """
    logger = logging.getLogger(__name__)

    try:
        tweet_date = datetime.strptime(
            tweet["tweet"]["created_at"], "%a %b %d %X %z %Y"
        )
    except KeyError:
        print(tweet)
        logger.warning("Tweet %s has no 'created_at' field", tweet["tweet"]["id"])
        return False
    if tweet_date >= date:
        return True
    return False