def create_session(self, user_id=None, password=None, verify_password=True, key=None):
    if not user_id:
      user_id = ''
    user_id = user_id.lower()
    account = user_id and self._get_account(user_id)
    if user_id and (not account or (verify_password and not secret.verify_password(password, account['password']))):
      raise TotoException(ERROR_USER_NOT_FOUND, "Invalid user ID or password")
    session_id = TotoSession.generate_id()
    expires = time() + (user_id and self.session_ttl or self.anon_session_ttl)
    session_data = {'user_id': user_id, 'expires': expires, 'session_id': session_id}
    if key:
      session_data['key'] = key
    self._prepare_session(account, session_data)
    if not self._cache_session_data(session_data):
      self._store_session(session_id, session_data)
    session = self._instantiate_session(session_data, self._session_cache)
    return session
Test wire.Echo protocol: send some data and check it send it back.
dataset/ETHPy150Open JeremyOT/Toto/toto/dbconnection.py/DBConnection.create_session--crossover with--dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/test/test_protocols.py/WireTestCase.test_echo