def datetime_from_rfc822(datetime_str):
 return datetime.fromtimestamp(mktime_tz(parsedate_tz(datetime_str)), pytz.utc)

def datetime_from_rfc822 ( datetime_str ) : return datetime . fromtimestamp ( mktime_tz ( parsedate_tz ( datetime_str ) ) , pytz . utc )
turns an rfc822 formatted date into a datetime object .