code: def security_layer(tls_provider, sasl_providers):
      
  
      sasl_providers = tuple(sasl_providers)
  
      if not sasl_providers:
          raise ValueError("At least one SASL provider must be given.")
      for sasl_provider in sasl_providers:
          sasl_provider.execute  # check that sasl_provider has execute method
  
      result = SecurityLayer(
          tls_provider.ssl_context_factory,
          tls_provider.certificate_verifier_factory,
          tls_provider.tls_required,
          sasl_providers
      )
  
      return result
docs: .. deprecated:: 0.6
  
         Replaced by :class:`SecurityLayer`.
  
      Return a configured :class:`SecurityLayer`. `tls_provider` must be a
      :class:`STARTTLSProvider`.
  
      The return value can be passed to the constructor of
      :class:`~.node.Client`.
  
      Some very basic checking on the input is also performed.