generate options automatically
works in python2