def removeSession(self, session):
        """
        Remove a session from both session registries.
        """
        negotiatorKey = session.getParentNegotiatorKey()
        peerUser = session.sharingWithUser
        if negotiatorKey in self.sessionsByUserByNegotiator:
            sessionsByUser = self.sessionsByUserByNegotiator[negotiatorKey]
            if peerUser in sessionsByUser:
                sessionsByUser[peerUser].discard(session)
        if self.sessionsByViewId.values() in session:
            for viewId, registeredSession in self.sessionsByViewId.items():
                if session == registeredSession:
                    self.sessionsByViewId.pop(viewId, None)


##################################################


# borrowing sys.modules global access approach used by the twisted reactor implementation, albeit a different implementation
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/sub_collab/registry.py/Registry.removeSession/swapped operands of `in`