changed hook to be generic for python and c++, added searn example to library