We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Implement env var for OpenSSL 1.0.1 support
As part of #4923 we need to add `CRYPTOGRAPHY_ALLOW_OPENSSL_101` and update CI to test using that.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/cryptography/hazmat/bindings/openssl/binding.py`
Content:
```
1 # This file is dual licensed under the terms of the Apache License, Version
2 # 2.0, and the BSD License. See the LICENSE file in the root of this repository
3 # for complete details.
4 
5 from __future__ import absolute_import, division, print_function
6 
7 import collections
8 import threading
9 import types
10 import warnings
11 
12 import cryptography
13 from cryptography import utils
14 from cryptography.exceptions import InternalError
15 from cryptography.hazmat.bindings._openssl import ffi, lib
16 from cryptography.hazmat.bindings.openssl._conditional import CONDITIONAL_NAMES
17 
18 _OpenSSLErrorWithText = collections.namedtuple(
19     "_OpenSSLErrorWithText", ["code", "lib", "func", "reason", "reason_text"]
20 )
21 
22 
23 class _OpenSSLError(object):
24     def __init__(self, code, lib, func, reason):
25         self._code = code
26         self._lib = lib
27         self._func = func
28         self._reason = reason
29 
30     def _lib_reason_match(self, lib, reason):
31         return lib == self.lib and reason == self.reason
32 
33     code = utils.read_only_property("_code")
34     lib = utils.read_only_property("_lib")
35     func = utils.read_only_property("_func")
36     reason = utils.read_only_property("_reason")
37 
38 
39 def _consume_errors(lib):
40     errors = []
41     while True:
42         code = lib.ERR_get_error()
43         if code == 0:
44             break
45 
46         err_lib = lib.ERR_GET_LIB(code)
47         err_func = lib.ERR_GET_FUNC(code)
48         err_reason = lib.ERR_GET_REASON(code)
49 
50         errors.append(_OpenSSLError(code, err_lib, err_func, err_reason))
51 
52     return errors
53 
54 
55 def _openssl_assert(lib, ok):
56     if not ok:
57         errors = _consume_errors(lib)
58         errors_with_text = []
59         for err in errors:
60             buf = ffi.new("char[]", 256)
61             lib.ERR_error_string_n(err.code, buf, len(buf))
62             err_text_reason = ffi.string(buf)
63 
64             errors_with_text.append(
65                 _OpenSSLErrorWithText(
66                     err.code, err.lib, err.func, err.reason, err_text_reason
67                 )
68             )
69 
70         raise InternalError(
71             "Unknown OpenSSL error. This error is commonly encountered when "
72             "another library is not cleaning up the OpenSSL error stack. If "
73             "you are using cryptography with another library that uses "
74             "OpenSSL try disabling it before reporting a bug. Otherwise "
75             "please file an issue at https://github.com/pyca/cryptography/"
76             "issues with information on how to reproduce "
77             "this. ({0!r})".format(errors_with_text),
78             errors_with_text
79         )
80 
81 
82 def build_conditional_library(lib, conditional_names):
83     conditional_lib = types.ModuleType("lib")
84     conditional_lib._original_lib = lib
85     excluded_names = set()
86     for condition, names_cb in conditional_names.items():
87         if not getattr(lib, condition):
88             excluded_names.update(names_cb())
89 
90     for attr in dir(lib):
91         if attr not in excluded_names:
92             setattr(conditional_lib, attr, getattr(lib, attr))
93 
94     return conditional_lib
95 
96 
97 class Binding(object):
98     """
99     OpenSSL API wrapper.
100     """
101     lib = None
102     ffi = ffi
103     _lib_loaded = False
104     _init_lock = threading.Lock()
105     _lock_init_lock = threading.Lock()
106 
107     def __init__(self):
108         self._ensure_ffi_initialized()
109 
110     @classmethod
111     def _register_osrandom_engine(cls):
112         # Clear any errors extant in the queue before we start. In many
113         # scenarios other things may be interacting with OpenSSL in the same
114         # process space and it has proven untenable to assume that they will
115         # reliably clear the error queue. Once we clear it here we will
116         # error on any subsequent unexpected item in the stack.
117         cls.lib.ERR_clear_error()
118         if cls.lib.Cryptography_HAS_ENGINE:
119             result = cls.lib.Cryptography_add_osrandom_engine()
120             _openssl_assert(cls.lib, result in (1, 2))
121 
122     @classmethod
123     def _ensure_ffi_initialized(cls):
124         with cls._init_lock:
125             if not cls._lib_loaded:
126                 cls.lib = build_conditional_library(lib, CONDITIONAL_NAMES)
127                 cls._lib_loaded = True
128                 # initialize the SSL library
129                 cls.lib.SSL_library_init()
130                 # adds all ciphers/digests for EVP
131                 cls.lib.OpenSSL_add_all_algorithms()
132                 # loads error strings for libcrypto and libssl functions
133                 cls.lib.SSL_load_error_strings()
134                 cls._register_osrandom_engine()
135 
136     @classmethod
137     def init_static_locks(cls):
138         with cls._lock_init_lock:
139             cls._ensure_ffi_initialized()
140             # Use Python's implementation if available, importing _ssl triggers
141             # the setup for this.
142             __import__("_ssl")
143 
144             if (not cls.lib.Cryptography_HAS_LOCKING_CALLBACKS or
145                     cls.lib.CRYPTO_get_locking_callback() != cls.ffi.NULL):
146                 return
147 
148             # If nothing else has setup a locking callback already, we set up
149             # our own
150             res = lib.Cryptography_setup_ssl_threads()
151             _openssl_assert(cls.lib, res == 1)
152 
153 
154 def _verify_openssl_version(lib):
155     if (
156         lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_102 and
157         not lib.CRYPTOGRAPHY_IS_LIBRESSL
158     ):
159         warnings.warn(
160             "OpenSSL version 1.0.1 is no longer supported by the OpenSSL "
161             "project, please upgrade. The next version of cryptography will "
162             "drop support for it.",
163             utils.CryptographyDeprecationWarning
164         )
165 
166 
167 def _verify_package_version(version):
168     # Occasionally we run into situations where the version of the Python
169     # package does not match the version of the shared object that is loaded.
170     # This may occur in environments where multiple versions of cryptography
171     # are installed and available in the python path. To avoid errors cropping
172     # up later this code checks that the currently imported package and the
173     # shared object that were loaded have the same version and raise an
174     # ImportError if they do not
175     so_package_version = ffi.string(lib.CRYPTOGRAPHY_PACKAGE_VERSION)
176     if version.encode("ascii") != so_package_version:
177         raise ImportError(
178             "The version of cryptography does not match the loaded "
179             "shared object. This can happen if you have multiple copies of "
180             "cryptography installed in your Python path. Please try creating "
181             "a new virtual environment to resolve this issue. "
182             "Loaded python version: {}, shared object version: {}".format(
183                 version, so_package_version
184             )
185         )
186 
187 
188 _verify_package_version(cryptography.__version__)
189 
190 # OpenSSL is not thread safe until the locks are initialized. We call this
191 # method in module scope so that it executes with the import lock. On
192 # Pythons < 3.4 this import lock is a global lock, which can prevent a race
193 # condition registering the OpenSSL locks. On Python 3.4+ the import lock
194 # is per module so this approach will not work.
195 Binding.init_static_locks()
196 
197 _verify_openssl_version(Binding.lib)
198
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/cryptography/hazmat/bindings/openssl/binding.py b/src/cryptography/hazmat/bindings/openssl/binding.py
--- a/src/cryptography/hazmat/bindings/openssl/binding.py
+++ b/src/cryptography/hazmat/bindings/openssl/binding.py
@@ -5,6 +5,7 @@
 from __future__ import absolute_import, division, print_function
 
 import collections
+import os
 import threading
 import types
 import warnings
@@ -156,12 +157,19 @@
         lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_102 and
         not lib.CRYPTOGRAPHY_IS_LIBRESSL
     ):
-        warnings.warn(
-            "OpenSSL version 1.0.1 is no longer supported by the OpenSSL "
-            "project, please upgrade. The next version of cryptography will "
-            "drop support for it.",
-            utils.CryptographyDeprecationWarning
-        )
+        if os.environ.get("CRYPTOGRAPHY_ALLOW_OPENSSL_101"):
+            warnings.warn(
+                "OpenSSL version 1.0.1 is no longer supported by the OpenSSL "
+                "project, please upgrade. The next version of cryptography "
+                "will completely remove support for it.",
+                utils.CryptographyDeprecationWarning
+            )
+        else:
+            raise RuntimeError(
+                "You are linking against OpenSSL 1.0.1, which is no longer "
+                "supported by the OpenSSL project. You need to upgrade to a "
+                "newer version of OpenSSL."
+            )
 
 
 def _verify_package_version(version):

{"golden_diff": "diff --git a/src/cryptography/hazmat/bindings/openssl/binding.py b/src/cryptography/hazmat/bindings/openssl/binding.py\n--- a/src/cryptography/hazmat/bindings/openssl/binding.py\n+++ b/src/cryptography/hazmat/bindings/openssl/binding.py\n@@ -5,6 +5,7 @@\n from __future__ import absolute_import, division, print_function\n \n import collections\n+import os\n import threading\n import types\n import warnings\n@@ -156,12 +157,19 @@\n         lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_102 and\n         not lib.CRYPTOGRAPHY_IS_LIBRESSL\n     ):\n-        warnings.warn(\n-            \"OpenSSL version 1.0.1 is no longer supported by the OpenSSL \"\n-            \"project, please upgrade. The next version of cryptography will \"\n-            \"drop support for it.\",\n-            utils.CryptographyDeprecationWarning\n-        )\n+        if os.environ.get(\"CRYPTOGRAPHY_ALLOW_OPENSSL_101\"):\n+            warnings.warn(\n+                \"OpenSSL version 1.0.1 is no longer supported by the OpenSSL \"\n+                \"project, please upgrade. The next version of cryptography \"\n+                \"will completely remove support for it.\",\n+                utils.CryptographyDeprecationWarning\n+            )\n+        else:\n+            raise RuntimeError(\n+                \"You are linking against OpenSSL 1.0.1, which is no longer \"\n+                \"supported by the OpenSSL project. You need to upgrade to a \"\n+                \"newer version of OpenSSL.\"\n+            )\n \n \n def _verify_package_version(version):\n", "issue": "Implement env var for OpenSSL 1.0.1 support\nAs part of #4923 we need to add `CRYPTOGRAPHY_ALLOW_OPENSSL_101` and update CI to test using that.\n", "before_files": [{"content": "# This file is dual licensed under the terms of the Apache License, Version\n# 2.0, and the BSD License. See the LICENSE file in the root of this repository\n# for complete details.\n\nfrom __future__ import absolute_import, division, print_function\n\nimport collections\nimport threading\nimport types\nimport warnings\n\nimport cryptography\nfrom cryptography import utils\nfrom cryptography.exceptions import InternalError\nfrom cryptography.hazmat.bindings._openssl import ffi, lib\nfrom cryptography.hazmat.bindings.openssl._conditional import CONDITIONAL_NAMES\n\n_OpenSSLErrorWithText = collections.namedtuple(\n    \"_OpenSSLErrorWithText\", [\"code\", \"lib\", \"func\", \"reason\", \"reason_text\"]\n)\n\n\nclass _OpenSSLError(object):\n    def __init__(self, code, lib, func, reason):\n        self._code = code\n        self._lib = lib\n        self._func = func\n        self._reason = reason\n\n    def _lib_reason_match(self, lib, reason):\n        return lib == self.lib and reason == self.reason\n\n    code = utils.read_only_property(\"_code\")\n    lib = utils.read_only_property(\"_lib\")\n    func = utils.read_only_property(\"_func\")\n    reason = utils.read_only_property(\"_reason\")\n\n\ndef _consume_errors(lib):\n    errors = []\n    while True:\n        code = lib.ERR_get_error()\n        if code == 0:\n            break\n\n        err_lib = lib.ERR_GET_LIB(code)\n        err_func = lib.ERR_GET_FUNC(code)\n        err_reason = lib.ERR_GET_REASON(code)\n\n        errors.append(_OpenSSLError(code, err_lib, err_func, err_reason))\n\n    return errors\n\n\ndef _openssl_assert(lib, ok):\n    if not ok:\n        errors = _consume_errors(lib)\n        errors_with_text = []\n        for err in errors:\n            buf = ffi.new(\"char[]\", 256)\n            lib.ERR_error_string_n(err.code, buf, len(buf))\n            err_text_reason = ffi.string(buf)\n\n            errors_with_text.append(\n                _OpenSSLErrorWithText(\n                    err.code, err.lib, err.func, err.reason, err_text_reason\n                )\n            )\n\n        raise InternalError(\n            \"Unknown OpenSSL error. This error is commonly encountered when \"\n            \"another library is not cleaning up the OpenSSL error stack. If \"\n            \"you are using cryptography with another library that uses \"\n            \"OpenSSL try disabling it before reporting a bug. Otherwise \"\n            \"please file an issue at https://github.com/pyca/cryptography/\"\n            \"issues with information on how to reproduce \"\n            \"this. ({0!r})\".format(errors_with_text),\n            errors_with_text\n        )\n\n\ndef build_conditional_library(lib, conditional_names):\n    conditional_lib = types.ModuleType(\"lib\")\n    conditional_lib._original_lib = lib\n    excluded_names = set()\n    for condition, names_cb in conditional_names.items():\n        if not getattr(lib, condition):\n            excluded_names.update(names_cb())\n\n    for attr in dir(lib):\n        if attr not in excluded_names:\n            setattr(conditional_lib, attr, getattr(lib, attr))\n\n    return conditional_lib\n\n\nclass Binding(object):\n    \"\"\"\n    OpenSSL API wrapper.\n    \"\"\"\n    lib = None\n    ffi = ffi\n    _lib_loaded = False\n    _init_lock = threading.Lock()\n    _lock_init_lock = threading.Lock()\n\n    def __init__(self):\n        self._ensure_ffi_initialized()\n\n    @classmethod\n    def _register_osrandom_engine(cls):\n        # Clear any errors extant in the queue before we start. In many\n        # scenarios other things may be interacting with OpenSSL in the same\n        # process space and it has proven untenable to assume that they will\n        # reliably clear the error queue. Once we clear it here we will\n        # error on any subsequent unexpected item in the stack.\n        cls.lib.ERR_clear_error()\n        if cls.lib.Cryptography_HAS_ENGINE:\n            result = cls.lib.Cryptography_add_osrandom_engine()\n            _openssl_assert(cls.lib, result in (1, 2))\n\n    @classmethod\n    def _ensure_ffi_initialized(cls):\n        with cls._init_lock:\n            if not cls._lib_loaded:\n                cls.lib = build_conditional_library(lib, CONDITIONAL_NAMES)\n                cls._lib_loaded = True\n                # initialize the SSL library\n                cls.lib.SSL_library_init()\n                # adds all ciphers/digests for EVP\n                cls.lib.OpenSSL_add_all_algorithms()\n                # loads error strings for libcrypto and libssl functions\n                cls.lib.SSL_load_error_strings()\n                cls._register_osrandom_engine()\n\n    @classmethod\n    def init_static_locks(cls):\n        with cls._lock_init_lock:\n            cls._ensure_ffi_initialized()\n            # Use Python's implementation if available, importing _ssl triggers\n            # the setup for this.\n            __import__(\"_ssl\")\n\n            if (not cls.lib.Cryptography_HAS_LOCKING_CALLBACKS or\n                    cls.lib.CRYPTO_get_locking_callback() != cls.ffi.NULL):\n                return\n\n            # If nothing else has setup a locking callback already, we set up\n            # our own\n            res = lib.Cryptography_setup_ssl_threads()\n            _openssl_assert(cls.lib, res == 1)\n\n\ndef _verify_openssl_version(lib):\n    if (\n        lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_102 and\n        not lib.CRYPTOGRAPHY_IS_LIBRESSL\n    ):\n        warnings.warn(\n            \"OpenSSL version 1.0.1 is no longer supported by the OpenSSL \"\n            \"project, please upgrade. The next version of cryptography will \"\n            \"drop support for it.\",\n            utils.CryptographyDeprecationWarning\n        )\n\n\ndef _verify_package_version(version):\n    # Occasionally we run into situations where the version of the Python\n    # package does not match the version of the shared object that is loaded.\n    # This may occur in environments where multiple versions of cryptography\n    # are installed and available in the python path. To avoid errors cropping\n    # up later this code checks that the currently imported package and the\n    # shared object that were loaded have the same version and raise an\n    # ImportError if they do not\n    so_package_version = ffi.string(lib.CRYPTOGRAPHY_PACKAGE_VERSION)\n    if version.encode(\"ascii\") != so_package_version:\n        raise ImportError(\n            \"The version of cryptography does not match the loaded \"\n            \"shared object. This can happen if you have multiple copies of \"\n            \"cryptography installed in your Python path. Please try creating \"\n            \"a new virtual environment to resolve this issue. \"\n            \"Loaded python version: {}, shared object version: {}\".format(\n                version, so_package_version\n            )\n        )\n\n\n_verify_package_version(cryptography.__version__)\n\n# OpenSSL is not thread safe until the locks are initialized. We call this\n# method in module scope so that it executes with the import lock. On\n# Pythons < 3.4 this import lock is a global lock, which can prevent a race\n# condition registering the OpenSSL locks. On Python 3.4+ the import lock\n# is per module so this approach will not work.\nBinding.init_static_locks()\n\n_verify_openssl_version(Binding.lib)\n", "path": "src/cryptography/hazmat/bindings/openssl/binding.py"}], "after_files": [{"content": "# This file is dual licensed under the terms of the Apache License, Version\n# 2.0, and the BSD License. See the LICENSE file in the root of this repository\n# for complete details.\n\nfrom __future__ import absolute_import, division, print_function\n\nimport collections\nimport os\nimport threading\nimport types\nimport warnings\n\nimport cryptography\nfrom cryptography import utils\nfrom cryptography.exceptions import InternalError\nfrom cryptography.hazmat.bindings._openssl import ffi, lib\nfrom cryptography.hazmat.bindings.openssl._conditional import CONDITIONAL_NAMES\n\n_OpenSSLErrorWithText = collections.namedtuple(\n    \"_OpenSSLErrorWithText\", [\"code\", \"lib\", \"func\", \"reason\", \"reason_text\"]\n)\n\n\nclass _OpenSSLError(object):\n    def __init__(self, code, lib, func, reason):\n        self._code = code\n        self._lib = lib\n        self._func = func\n        self._reason = reason\n\n    def _lib_reason_match(self, lib, reason):\n        return lib == self.lib and reason == self.reason\n\n    code = utils.read_only_property(\"_code\")\n    lib = utils.read_only_property(\"_lib\")\n    func = utils.read_only_property(\"_func\")\n    reason = utils.read_only_property(\"_reason\")\n\n\ndef _consume_errors(lib):\n    errors = []\n    while True:\n        code = lib.ERR_get_error()\n        if code == 0:\n            break\n\n        err_lib = lib.ERR_GET_LIB(code)\n        err_func = lib.ERR_GET_FUNC(code)\n        err_reason = lib.ERR_GET_REASON(code)\n\n        errors.append(_OpenSSLError(code, err_lib, err_func, err_reason))\n\n    return errors\n\n\ndef _openssl_assert(lib, ok):\n    if not ok:\n        errors = _consume_errors(lib)\n        errors_with_text = []\n        for err in errors:\n            buf = ffi.new(\"char[]\", 256)\n            lib.ERR_error_string_n(err.code, buf, len(buf))\n            err_text_reason = ffi.string(buf)\n\n            errors_with_text.append(\n                _OpenSSLErrorWithText(\n                    err.code, err.lib, err.func, err.reason, err_text_reason\n                )\n            )\n\n        raise InternalError(\n            \"Unknown OpenSSL error. This error is commonly encountered when \"\n            \"another library is not cleaning up the OpenSSL error stack. If \"\n            \"you are using cryptography with another library that uses \"\n            \"OpenSSL try disabling it before reporting a bug. Otherwise \"\n            \"please file an issue at https://github.com/pyca/cryptography/\"\n            \"issues with information on how to reproduce \"\n            \"this. ({0!r})\".format(errors_with_text),\n            errors_with_text\n        )\n\n\ndef build_conditional_library(lib, conditional_names):\n    conditional_lib = types.ModuleType(\"lib\")\n    conditional_lib._original_lib = lib\n    excluded_names = set()\n    for condition, names_cb in conditional_names.items():\n        if not getattr(lib, condition):\n            excluded_names.update(names_cb())\n\n    for attr in dir(lib):\n        if attr not in excluded_names:\n            setattr(conditional_lib, attr, getattr(lib, attr))\n\n    return conditional_lib\n\n\nclass Binding(object):\n    \"\"\"\n    OpenSSL API wrapper.\n    \"\"\"\n    lib = None\n    ffi = ffi\n    _lib_loaded = False\n    _init_lock = threading.Lock()\n    _lock_init_lock = threading.Lock()\n\n    def __init__(self):\n        self._ensure_ffi_initialized()\n\n    @classmethod\n    def _register_osrandom_engine(cls):\n        # Clear any errors extant in the queue before we start. In many\n        # scenarios other things may be interacting with OpenSSL in the same\n        # process space and it has proven untenable to assume that they will\n        # reliably clear the error queue. Once we clear it here we will\n        # error on any subsequent unexpected item in the stack.\n        cls.lib.ERR_clear_error()\n        if cls.lib.Cryptography_HAS_ENGINE:\n            result = cls.lib.Cryptography_add_osrandom_engine()\n            _openssl_assert(cls.lib, result in (1, 2))\n\n    @classmethod\n    def _ensure_ffi_initialized(cls):\n        with cls._init_lock:\n            if not cls._lib_loaded:\n                cls.lib = build_conditional_library(lib, CONDITIONAL_NAMES)\n                cls._lib_loaded = True\n                # initialize the SSL library\n                cls.lib.SSL_library_init()\n                # adds all ciphers/digests for EVP\n                cls.lib.OpenSSL_add_all_algorithms()\n                # loads error strings for libcrypto and libssl functions\n                cls.lib.SSL_load_error_strings()\n                cls._register_osrandom_engine()\n\n    @classmethod\n    def init_static_locks(cls):\n        with cls._lock_init_lock:\n            cls._ensure_ffi_initialized()\n            # Use Python's implementation if available, importing _ssl triggers\n            # the setup for this.\n            __import__(\"_ssl\")\n\n            if (not cls.lib.Cryptography_HAS_LOCKING_CALLBACKS or\n                    cls.lib.CRYPTO_get_locking_callback() != cls.ffi.NULL):\n                return\n\n            # If nothing else has setup a locking callback already, we set up\n            # our own\n            res = lib.Cryptography_setup_ssl_threads()\n            _openssl_assert(cls.lib, res == 1)\n\n\ndef _verify_openssl_version(lib):\n    if (\n        lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_102 and\n        not lib.CRYPTOGRAPHY_IS_LIBRESSL\n    ):\n        if os.environ.get(\"CRYPTOGRAPHY_ALLOW_OPENSSL_101\"):\n            warnings.warn(\n                \"OpenSSL version 1.0.1 is no longer supported by the OpenSSL \"\n                \"project, please upgrade. The next version of cryptography \"\n                \"will completely remove support for it.\",\n                utils.CryptographyDeprecationWarning\n            )\n        else:\n            raise RuntimeError(\n                \"You are linking against OpenSSL 1.0.1, which is no longer \"\n                \"supported by the OpenSSL project. You need to upgrade to a \"\n                \"newer version of OpenSSL.\"\n            )\n\n\ndef _verify_package_version(version):\n    # Occasionally we run into situations where the version of the Python\n    # package does not match the version of the shared object that is loaded.\n    # This may occur in environments where multiple versions of cryptography\n    # are installed and available in the python path. To avoid errors cropping\n    # up later this code checks that the currently imported package and the\n    # shared object that were loaded have the same version and raise an\n    # ImportError if they do not\n    so_package_version = ffi.string(lib.CRYPTOGRAPHY_PACKAGE_VERSION)\n    if version.encode(\"ascii\") != so_package_version:\n        raise ImportError(\n            \"The version of cryptography does not match the loaded \"\n            \"shared object. This can happen if you have multiple copies of \"\n            \"cryptography installed in your Python path. Please try creating \"\n            \"a new virtual environment to resolve this issue. \"\n            \"Loaded python version: {}, shared object version: {}\".format(\n                version, so_package_version\n            )\n        )\n\n\n_verify_package_version(cryptography.__version__)\n\n# OpenSSL is not thread safe until the locks are initialized. We call this\n# method in module scope so that it executes with the import lock. On\n# Pythons < 3.4 this import lock is a global lock, which can prevent a race\n# condition registering the OpenSSL locks. On Python 3.4+ the import lock\n# is per module so this approach will not work.\nBinding.init_static_locks()\n\n_verify_openssl_version(Binding.lib)\n", "path": "src/cryptography/hazmat/bindings/openssl/binding.py"}]}