Refactor python expression.