common code used by the reference server and python library