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 move those 2 lines in the if on line 1215 and remove the else close.