'reset sys.stdout/stderr and return captured output as strings.'

def reset(self):

    if hasattr(self, '_reset'):
        raise ValueError('was    already    reset')
    self._reset = True
    (outfile, errfile) = self.done(save=False)
    (out, err) = ('', '')
    if (outfile and (not outfile.closed)):
        out = outfile.read()
        outfile.close()
    if (errfile and (errfile != outfile) and (not errfile.closed)):
        err = errfile.read()
        errfile.close()
    return (out, err)
