See https://en.cppreference.com/w/cpp/types/result_of
Also not clear if this is the best way to include it. Probably need the std::variant approach here too.
Break up pybind11 interface into separate compilation units (not as beneficial as hoped); still very slow