Added support for an optional serializer.

Hi Fabian,

I added the option of passing a serializer.
I also added some tests to make sure it works.

Let me know if you are interested in merging it and releasing a new version on pypi.

Thanks
Michael
Additionally to the what-goes-in-comes-out tests, I guess there should be another tests that checks that the ``dumps`` and ``loads`` methods of the serializer are called from the library. Using mock. I can add that, if you like. -- I know, the test suite is not very elaborate (yet).

Otherwise this feature looks like a good addition.