code: def _resume_ssl_session(
              server_info: ServerConnectivityInfo,
              ssl_version_to_use: OpenSslVersionEnum,
              ssl_session: Optional[nassl._nassl.SSL_SESSION] = None,
              should_enable_tls_ticket: bool = False
      ) -> nassl._nassl.SSL_SESSION:
          
          ssl_connection = server_info.get_preconfigured_ssl_connection(override_ssl_version=ssl_version_to_use)
          if not should_enable_tls_ticket:
              # Need to disable TLS tickets to test session IDs, according to rfc5077:
              # If a ticket is presented by the client, the server MUST NOT attempt
              # to use the Session ID in the ClientHello for stateful session resumption
              ssl_connection.ssl_client.disable_stateless_session_resumption()  # Turning off TLS tickets.
  
          if ssl_session:
              ssl_connection.ssl_client.set_session(ssl_session)
  
          try:
              # Perform the SSL handshake
              ssl_connection.connect()
              new_session = ssl_connection.ssl_client.get_session()  # Get session data
          finally:
              ssl_connection.close()
  
          return new_session
docs: Connect to the server and returns the session object that was assigned for that connection.
          If ssl_session is given, tries to resume that session.