templates: Made python template pylint happy

* Moved option parsing to a separate function
* Made module level variables upper case
* Split future import because of line length
* Exception in if __name__ passes to the variable exc. In rest of code
  should use err. Had to use exc here to prevent a name collision
  between module level and individual functions and classes.
* Because it's a catch-all pylint will complain (W0703) that it's too
  general. It is assumed that message code is ignored in your
  ~/.pylintrc.
* Updated the example functions to make pylint happy