@core_helper
def parse_rfc_2822_date(date_str, assume_utc=True):
 time_tuple = email.utils.parsedate_tz(date_str)
 if (not time_tuple):
  return None
 if ((time_tuple[(-1)] is None) and (not assume_utc)):
  return datetime.datetime.fromtimestamp(email.utils.mktime_tz(time_tuple))
 else:
  offset = (0 if (time_tuple[(-1)] is None) else time_tuple[(-1)])
  tz_info = _RFC2282TzInfo(offset)
 return datetime.datetime(microsecond=0, tzinfo=tz_info, *time_tuple[:6])

@ core_helper def parse_rfc_2822_date ( date_str , assume_utc = True ) : time_tuple = email . utils . parsedate_tz ( date_str ) if ( not time_tuple ) : return None if ( ( time_tuple [ ( - 1 ) ] is None ) and ( not assume_utc ) ) : return datetime . datetime . fromtimestamp ( email . utils . mktime_tz ( time_tuple ) ) else : offset = ( 0 if ( time_tuple [ ( - 1 ) ] is None ) else time_tuple [ ( - 1 ) ] ) tz_info = _RFC2282TzInfo ( offset ) return datetime . datetime ( microsecond = 0 , tzinfo = tz_info , * time_tuple [ : 6 ] )
parse a date string of the form specified in rfc 2822 .