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
I know we need to re-work the opt db. But for now, we will disable this by default. The important things to get merged is the fixes to pickling and make the unpickling don't reoptimize based on some theano flags.

Then in a later PR, we can update the caching of optimization.