code: def parse_esmtp_extensions(message):
          
          extns = {}
          auths = []
  
          oldstyle_auth_regex = re.compile(r"auth=(?P<auth>.*)", re.IGNORECASE)
  
          extension_regex = re.compile(
              r"(?P<feature>[a-z0-9][a-z0-9\-]*) ?", re.IGNORECASE
          )
  
          lines = message.splitlines()
  
          for line in lines[1:]:
              # To be able to communicate with as many SMTP servers as possible,
              # we have to take the old-style auth advertisement into account.
              match = oldstyle_auth_regex.match(line)
  
              if match:
                  auth = match.group("auth")[0]
                  auth = auth.lower().strip()
  
                  if auth not in auths:
                      auths.append(auth)
  
              # RFC 1869 requires a space between EHLO keyword and parameters.
              # It's actually stricter, in that only spaces are allowed between
              # parameters, but were not going to check for that here.
              # Note that the space isn't present if there are no parameters.
              match = extension_regex.match(line)
  
              if match:
                  feature = match.group("feature").lower()
                  params = match.string[match.end("feature") :].strip()
  
                  extns[feature] = params
  
                  if feature == "auth":
                      auths.extend([param.strip().lower() for param in params.split()])
  
          return extns, auths
docs: Parses the response given by an ESMTP server after a *EHLO* command.
  
          The response is parsed to build:
  
          - A dict of supported ESMTP extensions (with parameters, if any).
          - A list of supported authentication methods.
  
          Returns:
              (dict, list): A (extensions, auth_mechanisms) 2-tuple containing
                  the supported extensions and authentication methods.