def decorator(method):

    @functools.wraps(method)
    def decorated(self, *args, **kwargs):
        try:
            return self.payload[payload_name]
        except KeyError:
            return method(self, *args, **kwargs)
    return decorated
def decorator(method):

    @functools.wraps(method)
    def decorated(self, *args, **kwargs):
        try:
            return self.payload[payload_name]
        except KeyError:
            return method(self, *args, **kwargs)
    return decorated