docs: def parse_mail_date(datestr):
      '''Helper method used by :meth:`Message.from_email_message` to
      convert dates from rfc822 format to iso 8601.
  
      :param datestr: string containing a date in rfc822 format
      :returns: string with date in iso 8601 format
      '''
  
      time_tuple = email.utils.parsedate_tz(datestr)
      if time_tuple is None:
          return datestr
      dt = datetime.datetime.fromtimestamp(email.utils.mktime_tz(time_tuple))
      return dt.isoformat()