def whitelist_method_generator(base, klass, whitelist):
method_wrapper_template ="""<STR_LIT>"""<EOL>property_wrapper_template ="""<STR_LIT>"""<EOL>for name in whitelist:<EOL><INDENT>if hasattr(base, name):<EOL><INDENT>continue<EOL><DEDENT>f = getattr(klass, name)<EOL>doc = f.__doc__<EOL>doc = doc if type(doc) == str else '<STR_LIT>'<EOL>if isinstance(f, types.MethodType):<EOL><INDENT>wrapper_template = method_wrapper_template<EOL>decl, args = make_signature(f)<EOL>args_by_name = ['<STR_LIT>'.format(arg) for arg in args[<NUM_LIT:1>:]]<EOL>params = {'<STR_LIT:name>': name,<EOL>'<STR_LIT>': doc,<EOL>'<STR_LIT>': '<STR_LIT:U+002C>'.join(decl),<EOL>'<STR_LIT>': args[<NUM_LIT:0>],<EOL>'<STR_LIT:args>': '<STR_LIT:U+002C>'.join(args_by_name)}<EOL><DEDENT>else:<EOL><INDENT>wrapper_template = property_wrapper_template<EOL>params = {'<STR_LIT:name>': name, '<STR_LIT>': doc}<EOL><DEDENT>yield wrapper_template % params<EOL><DEDENT>
Yields all GroupBy member defs for DataFrame/Series names in whitelist.

Parameters
----------
base : class
    base class
klass : class
    class where members are defined.
    Should be Series or DataFrame
whitelist : list
    list of names of klass methods to be constructed

Returns
-------
The generator yields a sequence of strings, each suitable for exec'ing,
that define implementations of the named methods for DataFrameGroupBy
or SeriesGroupBy.

Since we don't want to override methods explicitly defined in the
base class, any such name is skipped.