def get_history_user(self, instance):
        """Get the modifying user from instance or middleware."""
        try:
            return instance._history_user
        except AttributeError:
            try:
                if self.thread.request.user.is_authenticated():
                    return self.thread.request.user
                return None
            except __HOLE__:
                return None
dataset/ETHPy150Open treyhunner/django-simple-history/simple_history/models.py/HistoricalRecords.get_history_user