Utilities to help with plugins

Hi,

I added the file plugin_utils.py that contains some utils (more like shortcuts) that help write plugins. Such functions are useful in different plugins, they are easier to copy then peaces of code and hide some implementation details which I think is good.

On the way I came across a couple of bugs that were very annoying while I tried to test the above functions. Sorry that I mixed fixes, additional logs and new features. If it is a big problem I can split into 2 pull requests.

Alexey

PS: do you think a group say on Google groups would help the project because Yahoo is not the most popular place lately.