def get_person_redirect_link(pid):
    '''
    Returns the canonical name of a pid if found, the pid itself otherwise
    @param pid: int
    '''
    cname = tu.get_canonical_id_from_personid(pid)
    if len(cname) > 0:
        return str(cname[0][0])
    else:
        return str(pid)
def get_canonical_id_from_person_id(person_id):
    '''
    Finds the person  canonical name from personid (e.g. 1)

    @param person_id: the canonical ID
    @type person_id: string

    @return: result from the request or person_id on failure
    @rtype: int
    '''
    if not person_id or not (isinstance(person_id, str) or isinstance(person_id, int)):
        return person_id

    canonical_name = person_id

    try:
        canonical_name = tu.get_canonical_id_from_personid(person_id)[0][0]
    except IndexError:
        pass

    return canonical_name