code: def redirect_response(self, url, permanent=False):
          
          if permanent:
              self.send_response(301)
          else:
              self.send_response(302)
          self.send_header("Location", url)
          self.end_headers()
docs: Generate redirect response