def new_api_token(self, token=None):
        assert self.id is not None
        db = inspect(self).session
        if token is None:
            token = new_token()
        else:
            if len(token) < 8:
                raise ValueError("Tokens must be at least 8 characters, got %r" % token)
            found = APIToken.find(db, token)
            if found:
                raise ValueError("Collision on token: %s..." % token[:4])
        orm_token = APIToken(user_id=self.id)
        orm_token.token = token
        db.add(orm_token)
        db.commit()
        return token
A request to ask which two arms to duel next
dataset/ETHPy150Open jupyterhub/jupyterhub/jupyterhub/orm.py/User.new_api_token--crossover with--dataset/ETHPy150Open nextml/NEXT/next/apps/DuelingBanditsPureExploration/Prototype.py/DuelingBanditsPureExplorationPrototype.getQuery