def METHOD_NAME(cls, _db, data, patron):
    if patron.synchronize_annotations != True:
        return PATRON_NOT_OPTED_IN_TO_ANNOTATION_SYNC
    try:
        data = json.loads(data)
        if 'id' in data and data['id'] is None:
            del data['id']
        data = jsonld.expand(data)
    except ValueError as e:
        return INVALID_ANNOTATION_FORMAT
    if not data or not len(data) == 1:
        return INVALID_ANNOTATION_TARGET
    data = data[0]
    target = data.get("http://www.w3.org/ns/oa#hasTarget")
    if not target or not len(target) == 1:
        return INVALID_ANNOTATION_TARGET
    target = target[0]
    source = target.get("http://www.w3.org/ns/oa#hasSource")
    if not source or not len(source) == 1:
        return INVALID_ANNOTATION_TARGET
    source = source[0].get('@id')
    try:
        identifier, ignore = Identifier.parse_urn(_db, source)
    except ValueError as e:
        return INVALID_ANNOTATION_TARGET
    motivation = data.get("http://www.w3.org/ns/oa#motivatedBy")
    if not motivation or not len(motivation) == 1:
        return INVALID_ANNOTATION_MOTIVATION
    motivation = motivation[0].get('@id')
    if motivation not in Annotation.MOTIVATIONS:
        return INVALID_ANNOTATION_MOTIVATION
    loans = patron.loans
    loan_identifiers = [loan.license_pool.identifier for loan in loans]
    if identifier not in loan_identifiers:
        return INVALID_ANNOTATION_TARGET
    content = data.get("http://www.w3.org/ns/oa#hasBody")
    if content and len(content) == 1:
        content = content[0]
    else:
        content = None
    target = json.dumps(target)
    extra_kwargs = {}
    if motivation == Annotation.IDLING:
        # A given book can only have one 'idling' annotation.
        pass
    elif motivation == Annotation.BOOKMARKING:
        # A given book can only have one 'bookmarking' annotation
        # per target.
        extra_kwargs['target'] = target
    annotation, ignore = Annotation.get_one_or_create(
        _db, patron=patron, identifier=identifier,
        motivation=motivation, on_multiple='interchangeable',
        **extra_kwargs
    )
    annotation.target = target
    if content:
        annotation.content = json.dumps(content)
    annotation.active = True
    annotation.timestamp = utc_now()
    return annotation