code: def is_ssl_error(error=None):
      
      if error is None:
          error = sys.exc_info()[1]
      from OpenSSL import SSL
      return isinstance(error, SSL.Error)
docs: Checks if the given error (or the current one) is an SSL error.