def METHOD_NAME(self, passwd=None):
    if self._get_prompt().endswith(b"#"):
        return
    cmd = {u"command": u"enable"}
    if passwd:
        # Note: python-3.5 cannot combine u"" and r"" together.  Thus make
        # an r string and use to_text to ensure it's text on both py2 and py3.
        cmd[u"prompt"] = to_text(
            r"[\r\n]?(?:.*)?[Pp]assword: ?$", errors="surrogate_or_strict"
        )
        cmd[u"answer"] = passwd
        cmd[u"prompt_retry_check"] = True
    try:
        self._exec_cli_command(
            to_bytes(json.dumps(cmd), errors="surrogate_or_strict")
        )
        prompt = self._get_prompt()
        if prompt is None or not prompt.endswith(b"#"):
            raise AnsibleConnectionFailure(
                "failed to elevate privilege to enable mode still at prompt [%s]"
                % prompt
            )
    except AnsibleConnectionFailure as e:
        prompt = self._get_prompt()
        raise AnsibleConnectionFailure(
            "unable to elevate privilege to enable mode, at prompt [%s] with error: %s"
            % (prompt, e.message)
        )