Misc. Python fixes and cleanup.