def cleanup_decorator(func):
    """Decorator which runs cleanup before and after a function"""

    def clean_before_after(self, *args, **kwargs):  # pylint: disable=missing-docstring
        # pylint only complains about a missing docstring on py2.7?
        self.cleanup()
        result = func(self, *args, **kwargs)
        self.cleanup()
        return result
    return clean_before_after