code: public void doPython(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
          setHeaders(rsp);
          rsp.serveExposedBean(req,bean, Flavor.PYTHON);
      }
docs: Exposes the bean as Python literal.