Adding functions to deal with Python in NS