def verify(self, *args, **kwargs):
        # second auth with code
        if "code" in kwargs:
            code = kwargs["code"]

            try:
                entry = self.codes[code]
            except __HOLE__:
                return self.FAILED_AUTHN

            username = entry["username"]
            # Verify code is not too old
            now = time.time()
            if now - entry["time"] > self.code_ttl:
                return self.FAILED_AUTHN

            del self.codes[code]  # Removed used code
            return username, True

        else:
            result = self.first_factor.verify(*args, **kwargs)
            if result == self.FAILED_AUTHN:
                return self.FAILED_AUTHN

            username, _ = result
            try:
                receiver = self.user_db[username]["email"]
            except KeyError:
                # Missing user or no mail address
                self.FAILED_AUTHN

            # Generate code and send it
            code = hashlib.md5(str(time.time())).hexdigest()
            self.codes[code] = {"username": username, "time": time.time()}
            self._send_mail(code, receiver)

            template = self.template_env.get_template(self.template)
            response = Response(template.render(mail=receiver,
                                                action=self.url_endpoint,
                                                state=json.dumps(
                                                    kwargs["state"])))
            return response, False
dataset/ETHPy150Open ga4gh/server/oidc-provider/simple_op/src/provider/authn/two_factor.py/MailTwoFactor.verify