def _copyLink(syn, entity, destinationId):
    """
    Copies Link entities

    :param entity:          A synapse ID of a Link entity

    :param destinationId:   Synapse ID of a folder/project that the file wants to be copied to
    """
    ent = syn.get(entity)
    #CHECK: If Link is in the same parent directory (throw an error)
    search = syn.query(destinationId%'select name from entity where parentId =="%s"')
    for i in search['results']:
        if i['entity.name'] == ent.name:
            raise ValueError('An item named "%s" already exists in this location. Link could not be copied'%ent.name)

    newLink = Link(ent.linksTo['targetId'],parent=destinationId,targetVersion=ent.linksTo['targetVersionNumber'])
    newLink = syn.store(newLink)
    return(newLink.id)

#Function to assist in getting wiki headers of subwikipages
dataset/ETHPy150Open Sage-Bionetworks/synapsePythonClient/synapseutils/copy.py/_copyLink/swapped operands of `%`