def possibleKeyError(func):
    @wraps(func)
    def wrapper(self, *args, **kargs):
        try:
            return func(self, *args, **kargs)
        except KeyError:
            raise Exception("Unexpected response in method %s with args %s and kargs %s" % (func.__name__, str(args), str(kargs)) )

    return wrapper
dataset/ETHPy150Open weblabdeusto/weblabdeusto/server/src/weblab/admin/bot/client.py/possibleKeyError/original