bat.py is the example you want