def dxlink(object_id, project_id=None, field=None):
    '''
    :param object_id: Object ID or the object handler itself
    :type object_id: string or :class:`~dxpy.bindings.DXDataObject`
    :param project_id: A project ID, if creating a cross-project DXLink
    :type project_id: string
    :param field: A field name, if creating a job-based object reference
    :type field: string
    :returns: A dict formatted as a symbolic DNAnexus object reference
    :rtype: dict

    Creates a DXLink to the specified object.

    If `object_id` is already a link, it is returned without modification.

    If `object_id is a `~dxpy.bindings.DXDataObject`, the object ID is
    retrieved via its `get_id()` method.

    If `field` is not `None`, `object_id` is expected to be of class 'job'
    and the link created is a Job Based Object Reference (JBOR), which is
    of the form::

        {'$dnanexus_link': {'job': object_id, 'field': field}}

    If `field` is `None` and `project_id` is not `None`, the link created
    is a project-specific link of the form::

        {'$dnanexus_link': {'project': project_id, 'id': object_id}}
    '''
    if is_dxlink(object_id):
        return object_id
    if isinstance(object_id, DXDataObject):
        object_id = object_id.get_id()
    if not any((project_id, field)):
        return {'$dnanexus_link': object_id}
    elif field:
        dxpy.verify_string_dxid(object_id, "job")
        return {'$dnanexus_link': {'job': object_id, 'field': field}}
    else:
        return {'$dnanexus_link': {'project': project_id, 'id': object_id}}