'Compute next `poll` time based on response ``Retry-After`` header.
Handles integers and various datestring formats per
https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.37
:param requests.Response response: Response from `poll`.
:param int default: Default value (in seconds), used when
``Retry-After`` header is not present or invalid.
:returns: Time point when next `poll` should be performed.
:rtype: `datetime.datetime`'

@classmethod
def retry_after(cls, response, default):

    retry_after = response.headers.get('Retry-After', str(default))
    try:
        seconds = int(retry_after)
    except ValueError:
        when = parsedate_tz(retry_after)
        if (when is not None):
            try:
                tz_secs = datetime.timedelta((when[(-1)] if when[(-1)] else 0))
                return (datetime.datetime(*when[:7]) - tz_secs)
            except (ValueError, OverflowError):
                pass
        seconds = default
    return (datetime.datetime.now() + datetime.timedelta(seconds=seconds))
