Do monkey patching before importing anything.

Read this for detailed problem:
http://stackoverflow.com/questions/8774958/keyerror-in-module-threading-after-a-successful-py-test-run
Fix a bug where msg.type was mistakenly used instead of msg.class_detail
Added support for uri-query.

I am not able to make out from RFC whether multiple uri-query string is supported or only one is allowed.
For now, this pycoap would support only one query string.