'Execute task code with given arguments.'

def __call__(self, *args, **kwargs):

    call = (lambda : super(RequestContextTask, self).__call__(*args, **kwargs))
    context = kwargs.pop(self.CONTEXT_ARG_NAME, None)
    gl = kwargs.pop(self.GLOBALS_ARG_NAME, {})
    if ((context is None) or has_request_context()):
        return call()
    with app.test_request_context(**context):
        for i in gl:
            setattr(g, i, gl[i])
        result = call()
    return result
