PyIOBase_Type error for script

Getting below error while compiling the upgrade script.

python3 ./config/upgradeFiles/

Traceback (most recent call last):
File “//./config/upgradeFiles/”, line 4, in
import _confd
File “/confd/src/confd/pyapi/_confd/”, line 19, in
from ._confd_py3 import cdb
ImportError: /confd/src/confd/pyapi/_confd/ undefined symbol: PyIOBase_Type

appreciated for pointers on above error.

just to add above error. this error seen when we wrote the python script for schema upgrade
with the below imports in the script
#!/usr/bin/env python
from future import print_function
import socket
import _confd
import _confd.cdb as cdb
import _confd.dp as dp
import _confd.maapi as maapi
import sys

There were backward-incompatible changes in Python API sometime around 3.8-3.9. One option is to downgrade your Python installation (or run your Python code in venv with older Python version), or upgrade your ConfD version - look for ENG-25176 in the CHANGES file. Or if you are a bit adventurous, you can modify ConfD’s Python API by removing all references to PyIOBase_Type and recompile.