Unify the scripts

This will make the scripts work across all recent python version (2.6 through to 3.3) in one script, making maintenance easier