def _transform_old_style_comments(annotation):
    """
    Transform an old-style, targetless "comment" into one with a target.

    If this annotation has a URI, but no targets and no references, then it's
    an "old-style" comment or "page note". Detect this for old clients and
    rewrite the annotation target property.
    """
    def isempty(container, field):
        val = container.get(field)
        return val is None or val == []

    has_uri = annotation.get('uri') is not None
    has_no_targets = isempty(annotation, 'target')
    has_no_references = isempty(annotation, 'references')

    if has_uri and has_no_targets and has_no_references:
        annotation['target'] = [{'source': annotation.get('uri')}]