def readline(self, timeout=None):
    if self._closed:
        raise Exception('Mock engine readline called after cleanup.')
    expected = self.expected[self.event]
    if (expected[0] != 'r'):
        raise Exception(('Mock engine readline called when expecting, %s' % (expected[1],)))
    self.event += 1
    return expected[1]
def readline(self, timeout=None):
    if self._closed:
        raise Exception('Mock engine readline called after cleanup.')
    expected = self.expected[self.event]
    if (expected[0] != 'r'):
        raise Exception(('Mock engine readline called when expecting, %s' % (expected[1],)))
    self.event += 1
    return expected[1]