I haven't got to the root of the problem nor know how to diagnose it.
However I did fix the problem by uninstalling netmiko -
pip uninstall netmiko
and uninstalled python version 3.13.
I have re-installed python 3.12 and installed:
pip install netmiko==4.2.0
and it fixed the problem.