code: def tls_with_password_based_authentication(
          password_provider,
          ssl_context_factory=default_ssl_context,
          max_auth_attempts=3,
          certificate_verifier_factory=PKIXCertificateVerifier):
      
  
      tls_kwargs = {}
      if certificate_verifier_factory is not None:
          tls_kwargs["certificate_verifier_factory"] = \
              certificate_verifier_factory
  
      return SecurityLayer(
          ssl_context_factory,
          certificate_verifier_factory,
          True,
          (
              PasswordSASLProvider(
                  password_provider,
                  max_auth_attempts=max_auth_attempts),
          )
      )
docs: Produce a commonly used :class:`SecurityLayer`, which uses TLS and
      password-based SASL authentication. If `ssl_context_factory` is not
      provided, an SSL context with TLSv1+ is used.
  
      `password_provider` must be a coroutine which is called with the jid
      as first and the number of attempt as second argument. It must return the
      password to us, or :data:`None` to abort.
  
      Return a :class:`SecurityLayer` instance.
  
      .. deprecated:: 0.7
  
         Use :func:`make` instead.