def merge_link_object(serializer, data, instance):

    link_object = {}

    if not getattr(instance, 'pk', None):
        # If instance doesn't have a `pk` field, we'll assume it doesn't
        # have a canonical resource URL to hang a link off of.
        # This generally only affectes Ephemeral Objects.
        return data

    link_fields = serializer.get_link_fields()
    for name, field in six.iteritems(link_fields):
        # For included fields, omit link if there's no data.
        if name in data and not data[name]:
            continue

        # Default to DREST-generated relation endpoints.
        link = getattr(field, 'link', "/%s/%s/%s/" % (
            serializer.get_plural_name(),
            instance.pk,
            name
        ))
        if callable(link):
            link = link(name, field, data, instance)

        link_object[name] = link

    if link_object:
        data['links'] = link_object
    return data
Specifically invoke p4 as the system command.
dataset/ETHPy150Open AltSchool/dynamic-rest/dynamic_rest/links.py/merge_link_object--crossover with--dataset/ETHPy150Open zulip/zulip/api/integrations/perforce/git_p4.py/p4_system