Python implementation of a monitor