Refactor python flickr scripts