Enhancement validate metadata

Adds Validation and Cleanup of Metadata and related unit testing

Note: Currently uses a github branch of my own for httprettty as there is a bug in httpretty with regards to Python3 that is exposed by these tests. This only affects the unit test functionality so that should not be an issue. We'll upgrade once httpretty has a release with the fixes.
could probably be moved out to be common.