def __init__(self, std='out', buffer=None):
    self.std = std
    self.buffer = (buffer or StringIO())
def __init__(self, std='out', buffer=None):
    self.std = std
    self.buffer = (buffer or StringIO())