Mongo DB connection via pymongo in Python not responding or hangs intermittently

@Shane Is there any other solutions.
It seems that at some point mongo db operations freezes. Even though that particular operation including ping command never responds but the very next operation may be success.
We are using pymongo version 3.10. We are facing the same issue in pymongo version 3.9 also.
We are only facing this intermittent issue in aws.