You might want to add logger.debug and other logging options instead of using print statements. Naarad code has used it.