def fetch_object(self, model_id):
pk_field_instance = getattr(self.object_class, self.pk_field)<EOL>qs = self.object_class.query.filter(pk_field_instance == model_id)<EOL>model = qs.one_or_none()<EOL>if not model:<EOL><INDENT>raise ReferenceNotFoundError<EOL><DEDENT>return model<EOL>
Fetch the model by its ID.