Documentation fixes

Add some API documentation and fix the formatting in much of the rest so that the python docs will generate more cleanly.
fixes ticket #14186