refactor debug python