'Wraps method with a screenshot on exception aspect.'

@classmethod
def wrap_method(mcs, method):

    def test_call_wrapper_method(*args, **kw):
        "The    wrapper    method\n\n                                                        Notes:\n                                                                The    method    name    has    to    start    with    *test*,    otherwise    the\n                                                                unittest    runner    won't    detect    is    as    a    test    method\n\n                                                        Args:\n                                                                *args:    Variable    argument    list    of    original    method\n                                                                **kw:    Arbitrary    keyword    arguments    of    the    original    method\n\n                                                        Returns:\n                                                                The    result    of    the    original    method    call\n                                                "
        try:
            results = method(*args, **kw)
        except:
            test_self = args[0]
            filename = ('%s_screenshot.png' % method.__name__)
            test_self.take_screenshot(filename)
            raise
        return results
    return test_call_wrapper_method
