move functions from srv.py to ns_api.py