code: def retryable_http_error( e ):
      
      if isinstance( e, urllib.error.HTTPError ) and e.code in ('503', '408', '500'):
          # The server returned one of:
          # 503 Service Unavailable
          # 408 Request Timeout
          # 500 Internal Server Error
          return True
      if isinstance( e, BadStatusLine ):
          # The server didn't return a valid response at all
          return True
      return False
docs: Determine if an error encountered during an HTTP download is likely to go away if we try again.