Added python major version caching to improve performance