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