Fix embedding interface for python 3. Add embedding self test.