'Returns the Session currently used.
@return: An instance of :py:class:`OpenSSL.SSL.Session` or :py:obj:`None` if
no session exists.'

def get_session(self):

    session = _lib.SSL_get1_session(self._ssl)
    if (session == _ffi.NULL):
        return None
    pysession = Session.__new__(Session)
    pysession._session = _ffi.gc(session, _lib.SSL_SESSION_free)
    return pysession
