code: async def auth(self, username, password):
          
          # EHLO/HELO is required:
          await self.ehlo_or_helo_if_needed()
  
          errors = []  # To store SMTPAuthenticationErrors
          code = message = None
  
          # Try to authenticate using all mechanisms supported by both
          # server and client (and only these):
          for auth, meth in self.__class__._supported_auth_mechanisms.items():
              if auth in self.auth_mechanisms:
                  auth_func = getattr(self, meth)
  
                  try:
                      code, message = await auth_func(username, password)
                  except SMTPAuthenticationError as e:
                      errors.append(e)
                  else:
                      break
          else:
              if not errors:
                  err = "Could not find any suitable authentication mechanism."
                  errors.append(SMTPAuthenticationError(-1, err))
  
              raise SMTPLoginError(errors)
  
          return code, message
docs: Tries to authenticate user against the SMTP server.
  
          Args:
              username (str): Username to authenticate with.
              password (str): Password to use along with the given ``username``.
  
          Raises:
              ConnectionResetError: If the connection with the server is
                  unexpectedely lost.
              SMTPCommandFailedError: If the server refuses our EHLO/HELO
                  greeting.
              SMTPLoginError: If the authentication failed (either because all
                  attempts failed or because there was no suitable authentication
                  mechanism).
  
          Returns:
              (int, str): A (code, message) 2-tuple containing the last server
                  response.