adding support for Python functions through Python C API