the good old leo script
new leo script, python rewrite due to api change