'return snapshot value of stdout/stderr capturings.'

def readouterr(self):

    out = err = ''
    if self.out:
        out = self.out.getvalue()
        self.out.truncate(0)
        self.out.seek(0)
    if self.err:
        err = self.err.getvalue()
        self.err.truncate(0)
        self.err.seek(0)
    return (out, err)
