Pickle and Unpickle theano functions

Added a test case to verify if pickle and unpickle a compiled theano function works.
Passed.

This is the follow up of gh-1945
You can change that to use the same mechanism as for revert().  Just add a new method to the History class.