code: def capture(self, *args, **kwargs):
          '''Run a task and return a dictionary with stderr, stdout and the
          return value. Also, the traceback from the exception if there was
          one'''
          import traceback
          try:
              from StringIO import StringIO
          except ImportError:
              from io import StringIO
          stdout, stderr = sys.stdout, sys.stderr
          sys.stdout = out = StringIO()
          sys.stderr = err = StringIO()
          result = {
              'exception': None,
              'stderr': None,
              'stdout': None,
              'return': None
          }
          try:
              result['return'] = self.__call__(*args, **kwargs)
          except Exception:
              result['exception'] = traceback.format_exc()
          sys.stdout, sys.stderr = stdout, stderr
          result['stderr'] = err.getvalue()
          result['stdout'] = out.getvalue()
          return resulf capture(self, *args, **kwargs):
          '''Run a task and return a dictionary with stderr, stdout and the
          return value. Also, the traceback from the exception if there was
          one'''
          import traceback
          try:
              from StringIO import StringIO
          except ImportError:
              from io import StringIO
          stdout, stderr = sys.stdout, sys.stderr
          sys.stdout = out = StringIO()
          sys.stderr = err = StringIO()
          result = {
              'exception': None,
              'stderr': None,
              'stdout': None,
              'return': None
          }
          try:
              result['return'] = self.__call__(*args, **kwargs)
          except Exception:
              result['exception'] = traceback.format_exc()
          sys.stdout, sys.stderr = stdout, stderr
          result['stderr'] = err.getvalue()
          result['stdout'] = out.getvalue()
          return result
docs: Run a task and return a dictionary with stderr, stdout and the
          return value. Also, the traceback from the exception if there was
          one