add _toJson function in utils/__init__.py

PR for http://trac.buildbot.net/ticket/2659
Well I think this is not exactly that. 
```
This function is a helper for json.dump, that allows to convert non-json able objects to json.
For now it supports converting datetime.datetime objects to unix timestamp.
```