ModuleNotFoundError: No module named '_ssl' in RHEL6 but works in RHEL7

I have installed python 3.9 in our buildfarm which has RHEL6 and RHEL7 OS. Some Unit tests are failing with below error on RHEL6. But same unit tests working fine on RHEL7. This means python installation is fine but it is something todo with RHEL6? Any pointers to debug this issue

import ssl
usr/software/pkgs/Python-3.9.0/lib/python3.9/ in
import _ssl # if we can’t import it, let the error propagate
E ModuleNotFoundError: No module named ‘_ssl’

It would be helpful to know from where or how you installed Python, but perhaps because the OpenSSL version on RHEL6 is too old to be supported by modern Python 3.9? The minimum version requirement has been increased in recent versions.