code: def _safe_call(self, is_reader, call, *args, **kwargs):
          
          start = time.time()
          while True:
              try:
                  return call(*args, **kwargs)
              except SSL.WantReadError:
                  # Sleep and try again. This is dangerous, because it means
                  # the rest of the stack has no way of differentiating
                  # between a "new handshake" error and "client dropped".
                  # Note this isn't an endless loop: there's a timeout below.
                  # Ref: https://stackoverflow.com/a/5133568/595220
                  time.sleep(self.ssl_retry)
              except SSL.WantWriteError:
                  time.sleep(self.ssl_retry)
              except SSL.SysCallError as e:
                  if is_reader and e.args == (-1, 'Unexpected EOF'):
                      return b''
  
                  errnum = e.args[0]
                  if is_reader and errnum in errors.socket_errors_to_ignore:
                      return b''
                  raise socket.error(errnum)
              except SSL.Error as e:
                  if is_reader and e.args == (-1, 'Unexpected EOF'):
                      return b''
  
                  thirdarg = None
                  try:
                      thirdarg = e.args[0][0][2]
                  except IndexError:
                      pass
  
                  if thirdarg == 'http request':
                      # The client is talking HTTP to an HTTPS server.
                      raise errors.NoSSLError()
  
                  raise errors.FatalSSLAlert(*e.args)
  
              if time.time() - start > self.ssl_timeout:
                  raise socket.timeout('timed out')
docs: Wrap the given call with SSL error-trapping.
  
          is_reader: if False EOF errors will be raised. If True, EOF errors
          will return "" (to emulate normal sockets).