Pylint complains that main() is too long and that's indeed true. Factor out single process call (together with all the prepartion) into separate function and keep only common code in main().