def _extract_retry_after_timeout(response):
    '''Returns the time in seconds that the server is asking us to
    wait. The information is deduced from the server http response.'''
    try:
        seconds_to_wait = int(response.headers.get('retry-after', DEFAULT_RETRY_AFTER_503_INTERVAL))
    except __HOLE__:
        # retry-after could be formatted as absolute time
        # instead of seconds to wait. We don't know how to
        # parse that, but the apiserver doesn't generate
        # such responses anyway.
        seconds_to_wait = DEFAULT_RETRY_AFTER_503_INTERVAL
    return max(1, seconds_to_wait)


# Truncate the message, if the error injection flag is on, and other
# conditions hold. This causes a BadRequest 400 HTTP code, which is
# subsequentally retried.
#
# Note: the minimal upload size for S3 is 5MB. In theory, you are
# supposed to get an "EntityTooSmall" error from S3, which has a 400
# code. However, I have not observed such responses in practice.
# http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html
dataset/ETHPy150Open dnanexus/dx-toolkit/src/python/dxpy/__init__.py/_extract_retry_after_timeout