Remove flush=True argument from print() since it is Python3.3+