prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Need zope.interface.verify.verifyObject for ABCs.
  Every object that claims to provide some interface should then use it in a unit test.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `cryptography/utils.py`
  Content:
  ```
  1 # Licensed under the Apache License, Version 2.0 (the "License");
  2 # you may not use this file except in compliance with the License.
  3 # You may obtain a copy of the License at
  4 #
  5 #    http://www.apache.org/licenses/LICENSE-2.0
  6 #
  7 # Unless required by applicable law or agreed to in writing, software
  8 # distributed under the License is distributed on an "AS IS" BASIS,
  9 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  10 # implied.
  11 # See the License for the specific language governing permissions and
  12 # limitations under the License.
  13 
  14 from __future__ import absolute_import, division, print_function
  15 
  16 import sys
  17 
  18 
  19 DeprecatedIn06 = DeprecationWarning
  20 
  21 
  22 def register_interface(iface):
  23     def register_decorator(klass):
  24         iface.register(klass)
  25         return klass
  26     return register_decorator
  27 
  28 
  29 def read_only_property(name):
  30     return property(lambda self: getattr(self, name))
  31 
  32 
  33 def bit_length(x):
  34     if sys.version_info >= (2, 7):
  35         return x.bit_length()
  36     else:
  37         return len(bin(x)) - (2 + (x <= 0))
  38
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/cryptography/utils.py b/cryptography/utils.py
  --- a/cryptography/utils.py
  +++ b/cryptography/utils.py
  @@ -13,6 +13,8 @@
   
   from __future__ import absolute_import, division, print_function
   
  +import abc
  +import inspect
   import sys
   
   
  @@ -21,6 +23,7 @@
   
   def register_interface(iface):
       def register_decorator(klass):
  +        verify_interface(iface, klass)
           iface.register(klass)
           return klass
       return register_decorator
  @@ -30,6 +33,30 @@
       return property(lambda self: getattr(self, name))
   
   
  +class InterfaceNotImplemented(Exception):
  +    pass
  +
  +
  +def verify_interface(iface, klass):
  +    for method in iface.__abstractmethods__:
  +        if not hasattr(klass, method):
  +            raise InterfaceNotImplemented(
  +                "{0} is missing a {1!r} method".format(klass, method)
  +            )
  +        if isinstance(getattr(iface, method), abc.abstractproperty):
  +            # Can't properly verify these yet.
  +            continue
  +        spec = inspect.getargspec(getattr(iface, method))
  +        actual = inspect.getargspec(getattr(klass, method))
  +        if spec != actual:
  +            raise InterfaceNotImplemented(
  +                "{0}.{1}'s signature differs from the expected. Expected: "
  +                "{2!r}. Received: {3!r}".format(
  +                    klass, method, spec, actual
  +                )
  +            )
  +
  +
   def bit_length(x):
       if sys.version_info >= (2, 7):
           return x.bit_length()
  
verification_info: {"golden_diff": "diff --git a/cryptography/utils.py b/cryptography/utils.py\n--- a/cryptography/utils.py\n+++ b/cryptography/utils.py\n@@ -13,6 +13,8 @@\n \n from __future__ import absolute_import, division, print_function\n \n+import abc\n+import inspect\n import sys\n \n \n@@ -21,6 +23,7 @@\n \n def register_interface(iface):\n     def register_decorator(klass):\n+        verify_interface(iface, klass)\n         iface.register(klass)\n         return klass\n     return register_decorator\n@@ -30,6 +33,30 @@\n     return property(lambda self: getattr(self, name))\n \n \n+class InterfaceNotImplemented(Exception):\n+    pass\n+\n+\n+def verify_interface(iface, klass):\n+    for method in iface.__abstractmethods__:\n+        if not hasattr(klass, method):\n+            raise InterfaceNotImplemented(\n+                \"{0} is missing a {1!r} method\".format(klass, method)\n+            )\n+        if isinstance(getattr(iface, method), abc.abstractproperty):\n+            # Can't properly verify these yet.\n+            continue\n+        spec = inspect.getargspec(getattr(iface, method))\n+        actual = inspect.getargspec(getattr(klass, method))\n+        if spec != actual:\n+            raise InterfaceNotImplemented(\n+                \"{0}.{1}'s signature differs from the expected. Expected: \"\n+                \"{2!r}. Received: {3!r}\".format(\n+                    klass, method, spec, actual\n+                )\n+            )\n+\n+\n def bit_length(x):\n     if sys.version_info >= (2, 7):\n         return x.bit_length()\n", "issue": "Need zope.interface.verify.verifyObject for ABCs.\nEvery object that claims to provide some interface should then use it in a unit test.\n\n", "before_files": [{"content": "# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n# implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom __future__ import absolute_import, division, print_function\n\nimport sys\n\n\nDeprecatedIn06 = DeprecationWarning\n\n\ndef register_interface(iface):\n    def register_decorator(klass):\n        iface.register(klass)\n        return klass\n    return register_decorator\n\n\ndef read_only_property(name):\n    return property(lambda self: getattr(self, name))\n\n\ndef bit_length(x):\n    if sys.version_info >= (2, 7):\n        return x.bit_length()\n    else:\n        return len(bin(x)) - (2 + (x <= 0))\n", "path": "cryptography/utils.py"}], "after_files": [{"content": "# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n# implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom __future__ import absolute_import, division, print_function\n\nimport abc\nimport inspect\nimport sys\n\n\nDeprecatedIn06 = DeprecationWarning\n\n\ndef register_interface(iface):\n    def register_decorator(klass):\n        verify_interface(iface, klass)\n        iface.register(klass)\n        return klass\n    return register_decorator\n\n\ndef read_only_property(name):\n    return property(lambda self: getattr(self, name))\n\n\nclass InterfaceNotImplemented(Exception):\n    pass\n\n\ndef verify_interface(iface, klass):\n    for method in iface.__abstractmethods__:\n        if not hasattr(klass, method):\n            raise InterfaceNotImplemented(\n                \"{0} is missing a {1!r} method\".format(klass, method)\n            )\n        if isinstance(getattr(iface, method), abc.abstractproperty):\n            # Can't properly verify these yet.\n            continue\n        spec = inspect.getargspec(getattr(iface, method))\n        actual = inspect.getargspec(getattr(klass, method))\n        if spec != actual:\n            raise InterfaceNotImplemented(\n                \"{0}.{1}'s signature differs from the expected. Expected: \"\n                \"{2!r}. Received: {3!r}\".format(\n                    klass, method, spec, actual\n                )\n            )\n\n\ndef bit_length(x):\n    if sys.version_info >= (2, 7):\n        return x.bit_length()\n    else:\n        return len(bin(x)) - (2 + (x <= 0))\n", "path": "cryptography/utils.py"}]}