Replace backticks with repr()
Replace "raise ValueError, msg" with "raise ValueError(msg)"
Replace mimetools with email