Misc fixes, mainly for GAE:
- Added import of html5lib to ensure it is available to BeautifulSoup
- Added a try/except block for loadhtml in parse to catch invalid urls
- More robust checking while refactoring spaces in the final tidy up
- Now returns a python dictionary - the caller can choose whether to convert this to json or consume it