code: def datetime_from_rfc822(value):
      """
      Turns an RFC822 formatted date into a datetime object.
  
      Example::
  
          inputs.datetime_from_rfc822('Wed, 02 Oct 2002 08:00:00 EST')
  
      :param str value: The RFC822-complying string to transform
      :return: The parsed datetime
      :rtype: datetime
      :raises ValueError: if value is an invalid date literal
  
      """
      raw = value
      if not time_regex.search(value):
          value = " ".join((value, "00:00:00"))
      try:
          timetuple = parsedate_tz(value)
          timestamp = mktime_tz(timetuple)
          if timetuple[-1] is None:
              return datetime.fromtimestamp(timestamp).replace(
                  tzinfo=pytz.utc
              )
          else:
              return datetime.fromtimestamp(timestamp, pytz.utc)
      except Exception:
          raise ValueError('Invalid date literal "{0}"'.format(raw))
  
imports: from __future__ import unicode_literals
  import re
  import socket
  from datetime import datetime, time, timedelta
  from email.utils import parsedate_tz, mktime_tz
  from six.moves.urllib.parse import urlparse
  import aniso8601
  import pytz
label_desc: Use image node_id 13 for calling a global function with example usage: datetime_from_rfc822(value) and returns: datetime, datetime