def add_annotation_link_generator(registry, name, generator):
    """
    Registers a function which generates a named link for an annotation.

    Annotation hypermedia links are added to the rendered annotations in a
    `links` property or similar. `name` is the unique identifier for the link
    type, and `generator` is a callable which accepts two arguments -- the
    current request, and the annotation for which to generate a link -- and
    returns a string.
    """
    if LINK_GENERATORS_KEY not in registry:
        registry[LINK_GENERATORS_KEY] = {}
    registry[LINK_GENERATORS_KEY][name] = generator
dataset/ETHPy150Open hypothesis/h/h/api/presenters.py/add_annotation_link_generator/original