def cleanup(self):
    if self._closed:
        raise Exception('Mock engine cleanup called multiple times.')
    self._closed = True
def cleanup(self):
    if self._closed:
        raise Exception('Mock engine cleanup called multiple times.')
    self._closed = True