Refactor python script
This MR refactors the Python script as follows:
- refactor script into functions with an entry-point style interface
- add argparse options for colour and output filename
- add better metadata
This MR refactors the Python script as follows: