def fetch_user(self, update=False):
        obj = json.loads(self.request.body.decode('utf-8'))

        if not update:
            try:
                username = obj.pop('username')
            except KeyError:
                raise ValueError()
        elif "username" in obj:
            del obj['username']

        try:
            password = obj.pop('password')
        except __HOLE__:
            raise ValueError()

        user_type = obj.pop('user_type', 1)
        if user_type == 0 and not self.api_key.is_admin():
            raise HTTPError(403)

        key = obj.pop('key', None)

        if not update:
            return username, password, user_type, key, obj
        return password, user_type, key, obj
dataset/ETHPy150Open benoitc/gaffer/gaffer/gafferd/http_handlers/user.py/UsersHandler.fetch_user