Review and update Pull Request #238.

* Add test_formats_rsakey_from_pem() test case and test condition for improperly formatted PEM.
* Add test condition to verify trailing white space is removed and matches the expected PEM format generated
internally.  Public PEMs generated externally (with the expected trailing newline) was not previously considered.
* re.sub() with the 'flags' keyword argument caused type error in Python 2.6.  Converted PEM validation to use index() to address issue above.
* Raise specific exception for missing header or missing footer.
* Check footer follows header.

Thanks @meskio for the pull request, and for supplying the scripts / PEM files to test.