def sub_path(self, path):
        """ If this redirect is a regular expression, it will return a
        rewritten version of `path`; otherwise returns the `new_path`. """
        if not self.regular_expression:
            return self.new_path
        return re.sub(self.old_path, self.new_path, path)
If this redirect is a regular expression, it will return a
        rewritten version of `path`; otherwise returns the `new_path`.