Sanitized coding style and improved documentation.

* Made coding style uniform, except in the exit node
  functions since they're being moved in another change.
* Improved documentation of all functions and added
  type hinting where appropriate.
* Added GPL license headers to all files.

Change-Id: I08ebffb01ff2e189b693eedd1d31b3350c1f94da
Merge "Sanitized coding style and improved documentation."