
from cryptography.hazmat.backends import openssl
from cryptography.hazmat.bindings.commoncrypto.binding import (
    Binding as CommonCryptoBinding
)

_ALL_BACKENDS = [openssl.backend]

if CommonCryptoBinding.is_available():
    from cryptography.hazmat.backends import commoncrypto
    _ALL_BACKENDS.append(commoncrypto.backend)


def default_backend():
    return openssl.backend


from cryptography.hazmat.backends import openssl
from cryptography.hazmat.backends.multibackend import MultiBackend
from cryptography.hazmat.bindings.commoncrypto.binding import (
    Binding as CommonCryptoBinding
)

_ALL_BACKENDS = [openssl.backend]

if CommonCryptoBinding.is_available():
    from cryptography.hazmat.backends import commoncrypto
    _ALL_BACKENDS.append(commoncrypto.backend)


_default_backend = MultiBackend(_ALL_BACKENDS)

def default_backend():
    return _default_backend

Make the default backend be a multi-backend
Make the default backend be a multi-backend

  
  from cryptography.hazmat.backends import openssl
+ from cryptography.hazmat.backends.multibackend import MultiBackend
  from cryptography.hazmat.bindings.commoncrypto.binding import (
      Binding as CommonCryptoBinding
  )
  
  _ALL_BACKENDS = [openssl.backend]
  
  if CommonCryptoBinding.is_available():
      from cryptography.hazmat.backends import commoncrypto
      _ALL_BACKENDS.append(commoncrypto.backend)
  
  
+ _default_backend = MultiBackend(_ALL_BACKENDS)
+ 
  def default_backend():
-     return openssl.backend
+     return _default_backend
  
Make the default backend be a multi-backend
## Code Before:

from cryptography.hazmat.backends import openssl
from cryptography.hazmat.bindings.commoncrypto.binding import (
    Binding as CommonCryptoBinding
)

_ALL_BACKENDS = [openssl.backend]

if CommonCryptoBinding.is_available():
    from cryptography.hazmat.backends import commoncrypto
    _ALL_BACKENDS.append(commoncrypto.backend)


def default_backend():
    return openssl.backend

## Instruction:
Make the default backend be a multi-backend
## Code After:

from cryptography.hazmat.backends import openssl
from cryptography.hazmat.backends.multibackend import MultiBackend
from cryptography.hazmat.bindings.commoncrypto.binding import (
    Binding as CommonCryptoBinding
)

_ALL_BACKENDS = [openssl.backend]

if CommonCryptoBinding.is_available():
    from cryptography.hazmat.backends import commoncrypto
    _ALL_BACKENDS.append(commoncrypto.backend)


_default_backend = MultiBackend(_ALL_BACKENDS)

def default_backend():
    return _default_backend
