def login_identity(self, user_identity, response=None, path='/'):
        key = os.urandom(10).encode('hex')
        response = web.Response() if response is None else response
        response.set_cookie(self._cookie_name, key, path=path)
        if not self.storage.set(self._cookie_name+':'+key.encode('utf-8'),
                                str(user_identity)):
            logger.warning('storage "%r" is unreachable', self.storage)
            if self.crash_without_storage:
                raise Exception(
                        'Storage {!r} is gone or down'.format(self.storage))
        return response
dataset/ETHPy150Open SmartTeleMax/iktomi/iktomi/auth.py/CookieAuth.login_identity/original