def METHOD_NAME(cls, annotation, with_context=True):
    item = dict()
    if with_context:
        item["@context"] = cls.JSONLD_CONTEXT
    item["id"] = url_for("annotation_detail", annotation_id=annotation.id,
                         library_short_name=annotation.patron.library.short_name,
                         _external=True)
    item["type"] = "Annotation"
    item["motivation"] = annotation.motivation
    item["body"] = annotation.content
    if annotation.target:
        target = json.loads(annotation.target)
        compacted = jsonld.compact(target, cls.JSONLD_CONTEXT)
        del compacted["@context"]
        item["target"] = compacted
    if annotation.content:
        body = json.loads(annotation.content)
        compacted = jsonld.compact(body, cls.JSONLD_CONTEXT)
        del compacted["@context"]
        item["body"] = compacted
    return item