cmake: improve FindPythonLibs.cmake

* Increase abstraction - code re-use.
* Fix usage of registry paths on Windows.