def _get_oncotreelink(syn, databasetosynid_mappingdf, oncotree_link=None):
    """
    Gets oncotree link unless a link is specified by the user

    Args:
        syn: Synapse object
        databasetosynid_mappingdf: database to synid mapping
        oncotree_link: link to oncotree. Default is None

    Returns:
        oncotree link

    """
    if oncotree_link is None:
        oncolink = databasetosynid_mappingdf.query(
            'Database == "oncotreeLink"').Id
        oncolink_ent = syn.get(oncolink.iloc[0])
        oncotree_link = oncolink_ent.externalURL
    return oncotree_link