def rfc1123_date(timestamp=None):
    """Create a RFC1123 style Date header for *timestamp*."""
    if timestamp is None:
        timestamp = time.time()
    timestamp = int(timestamp)
    global _cached_timestamp, _cached_datestring
    if timestamp != _cached_timestamp:
        # The time stamp must be GMT, and cannot be localized.
        tm = time.gmtime(timestamp)
        s = rfc1123_fmt.replace('%a', weekdays[tm.tm_wday]) \
                       .replace('%b', months[tm.tm_mon-1])
        _cached_datestring = time.strftime(s, tm)
        _cached_timestamp = timestamp
    return _cached_datestring