def METHOD_NAME(self, f):
    def p(templ, vars=None): # helper function to generate output
        if vars is None:
            vars = self.vars
        print >> f, templ % vars
    if self.__doc__:
        p(template.docstring)
    d = {"name" : self.vars["CName"],
         "args" : self.args.c_args(),
         }
    p(template.funcdef_start, d)
    self.args.dump_decls(f)
    if self.args.ml_meth == METH_VARARGS:
        p(template.varargs)
    p(template.funcdef_end)