split out python functionality into modules