factoring shared matlab+python code up to featpyra_common.cpp