def METHOD_NAME(self, *, base, target, annotation_type):
    """
    Returns a diff annotation from the sqlite database.
    Returns None if it isn't found.
    base: base Tree or Commit object for this diff (revA in a 'revA...revB' diff)
    target: target Tree or Commit object for this diff (revB in a 'revA...revB' diff)
    """
    with annotations_session(self.repo) as session:
        object_id = self._object_id(base, target)
        try:
            annotations = list(
                session.query(KartAnnotation).filter(
                    KartAnnotation.annotation_type == annotation_type,
                    KartAnnotation.object_id == object_id,
                )
            )
        except OperationalError as e:
            # this can happen if the db exists but is readonly and doesn't
            # contain the table yet...
            if "no such table: kart_annotations" in str(e):
                # can't add the table to a readonly db
                L.warning("no such table: kart_annotations")
                return None
            else:
                raise
        for annotation in annotations:
            data = annotation.json
            L.debug(
                "retrieved: %s for %s: %s",
                annotation_type,
                object_id,
                data,
            )
            return data
        else:
            L.debug(
                "missing: %s for %s",
                annotation_type,
                object_id,
            )
            return None