Convert datetime.datetime or Unix timestamp to HTTP date.

def datetime_to_httpdate(dt):
    """Convert datetime.datetime or Unix timestamp to HTTP date."""
    if isinstance(dt, (int, float)):
        return format_date_time(dt)
    elif isinstance(dt, datetime):
        return format_date_time(datetime_to_timestamp(dt))
    else:
        raise TypeError("expected datetime.datetime or timestamp (int/float),"
                        " got '%s'" % dt)