Add options for python3, make script more general