'Sets func to be called with *args and **kwargs during cleanup
:param function func: function to be called in case of an error'

def register(self, func, *args, **kwargs):

    self.funcs.append(functools.partial(func, *args, **kwargs))
