def _validate_authorization_code(self):
        """Validate an authorization_code request."""
        if self.code_key is None:
            raise InvalidRequest('No code_key provided')
        self._validate_access_credentials()
        try:
            self.code = Code.objects.get(key=self.code_key)
        except Code.DoesNotExist:
            raise InvalidRequest('No such code: %s' % self.code_key)
        now = TimestampGenerator()()
        if self.code.expire < now:
            raise InvalidGrant("Provided code is expired")
        self.scope = set([x.key for x in self.code.scope.all()])
        if self.redirect_uri is None:
            raise InvalidRequest('No redirect_uri')
        if normalize(self.redirect_uri) != normalize(self.code.redirect_uri):
            raise InvalidRequest("redirect_uri doesn't match")
dataset/ETHPy150Open hiidef/oauth2app/oauth2app/token.py/TokenGenerator._validate_authorization_code/original