def _possibly_unimplemented(cls, require=True):
if require:<EOL><INDENT>return cls<EOL><DEDENT>else:<EOL><INDENT>def wrap(fc):<EOL><INDENT>def wrapper(*a, **kw):<EOL><INDENT>try:<EOL><INDENT>return fc(*a, **kw)<EOL><DEDENT>except (NotImplementedError, TypeError, ValueError,<EOL>IndexError, AttributeError):<EOL><INDENT>raise nose.SkipTest("<STR_LIT>")<EOL><DEDENT><DEDENT>wrapper.__name__ = fc.__name__<EOL>return wrapper<EOL><DEDENT>new_dict = dict(cls.__dict__)<EOL>for name, func in cls.__dict__.items():<EOL><INDENT>if name.startswith('<STR_LIT>'):<EOL><INDENT>new_dict[name] = wrap(func)<EOL><DEDENT><DEDENT>return type(cls.__name__ + "<STR_LIT>",<EOL>cls.__bases__,<EOL>new_dict)<EOL><DEDENT>
Construct a class that either runs tests as usual (require=True),
or each method raises SkipTest if it encounters a common error.