<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _verify( self, request, return_payload=False, verify=True, raise_missing=False, request_args=None, request_kwargs=None, *args, **kwargs ):
 """ If there is a "permakey", then we will verify the token by checking the database. Otherwise, just do the normal verification. Typically, any method that begins with an underscore in sanic-jwt should not be touched. In this case, we are trying to break the rules a bit to handle a unique use case: handle both expirable and non-expirable tokens. """


        if "permakey" in request.headers:
            # Extract the permakey from the headers
            permakey = request.headers.get("permakey")

            # In production, probably should have some exception handling Here
            # in case the permakey is an empty string or some other bad value
            payload = self._decode(permakey, verify=verify)

            # Sometimes, the application will call _verify(...return_payload=True)
            # So, let's make sure to handle this scenario.
            if return_payload:
                return payload

            # Retrieve the user from the database
            user_id = payload.get("user_id", None)
            user = userid_table.get(user_id)

            # If wer cannot find a user, then this method should return
            # is_valid == False
            # reason == some text for why
            # status == some status code, probably a 401
            if not user_id or not user:
                is_valid = False
                reason = "No user found"
                status = 401
            else:
                # After finding a user, make sure the permakey matches,
                # or else return a bad status or some other error.
                # In production, both this scenario, and the above "No user found"
                # scenario should return an identical message and status code.
                # This is to prevent your application accidentally
                # leaking information about the existence or non-existence of users.
                is_valid = user.permakey == permakey
                reason = None if is_valid else "Permakey mismatch"
                status = 200 if is_valid else 401

            return is_valid, status, reason
        else:
            return super()._verify(
                request=request,
                return_payload=return_payload,
                verify=verify,
                raise_missing=raise_missing,
                request_args=request_args,
                request_kwargs=request_kwargs,
                *args,
                **kwargs
            )