i think that return s.dumps({'user_id': self.id}).decode('utf-8') cant rea for newer version of python