Created originally on Bitbucket by necaris (Rami Chowdhury)
Was already merged in Bitbucket before import, marked as merged by the import user
Use the Sphinx documentation tags for the appropriate code (http://sphinx-doc.org/domains.html#the-python-domain) to make the document clearer and add internal links, etc automatically. Also rewrite a few bits for conciseness and clarity.