Use dill for pickling if available.

As described here:
https://github.com/jaberg/hyperopt/issues/131

Passing a non-lambda function to `fmin()` with the mongo backend doesn't work as `cPickle` can't pickle functions. Dill, however (https://github.com/uqfoundation/dill) provides a pickle-like interface that makes this possible.

To remain backwards compatibility if dill is not installed I implemented a fall-back mechanism.