code: def shutdown(self) -> None:
          
          self._is_handshake_completed = False
          try:
              self._flush_ssl_engine()
          except IOError:
              # Ensure shutting down the connection never raises an exception
              pass
  
          try:
              self._ssl.shutdown()
          except OpenSSLError as e:
              # Ignore "uninitialized" exception
              if 'SSL_shutdown:uninitialized' not in str(e) and 'shutdown while in init' not in str(e):
                  raise
          if self._sock:
              self._sock.close()
docs: Close the TLS connection and the underlying network socket.