"""module docstring"""

# imports
# constants
# classes
# functions

def main(...):
    ...

if __name__ == '__main__':
    main()

My approach

  1. Modules for core functionality
  2. Script with paper specific functions and commands
  3. Command line interactions to allow control of the code

Example