completed mimic.py as written in the exercise