Added maximum depth to Python encoder.