Extract the SSL session ID from a SSL session object or raises IndexError if the session ID was not set.

def _extract_session_id(ssl_session: nassl._nassl.SSL_SESSION) -> str:
        """Extract the SSL session ID from a SSL session object or raises IndexError if the session ID was not set.
        """
        session_string = ((ssl_session.as_text()).split('Session-ID:'))[1]
        session_id = (session_string.split('Session-ID-ctx:'))[0].strip()
        return session_id