<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def has_offline_historical_manager_or_raise(self):
 """Raises an exception if model uses a history manager and historical model history_id is not a UUIDField. Note: expected to use edc_model.HistoricalRecords instead of simple_history.HistoricalRecords. """

        try:
            model = self.instance.__class__.history.model
        except AttributeError:
            model = self.instance.__class__
        field = [field for field in model._meta.fields if field.name == "history_id"]
        if field and not isinstance(field[0], UUIDField):
            raise OfflineHistoricalManagerError(
                f"Field 'history_id' of historical model "
                f"'{model._meta.app_label}.{model._meta.model_name}' "
                "must be an UUIDfield. "
                "For history = HistoricalRecords() use edc_model.HistoricalRecords instead of "
                "simple_history.HistoricalRecords(). "
                f"See '{self.instance._meta.app_label}.{self.instance._meta.model_name}'."
            )