MySQL transaction isolation level decorator

    class RequestThread(threading.Thread):
    
    def __init__(self, status, delay, **kwargs):
        super(threading.Thread, self).__init__(**kwargs)
        self.status = status
        self.thread = thread
    
    @transaction_decorator
    def run(self):
            """A dummy request."""
            try:
                with self.assertRaises(User.DoesNotExist):
                    User.objects.get(username='s1', email='s1@l.com')

                if self.delay > 0:
                    time.sleep(self.delay)

                __, created = User.objects.get_or_create(username='s1', email='s1@l.com')
            except Exception as exception:  # pylint: disable=broad-except
                self.status['exception'] = exception
            else:
                self.status['created'] = created