def get_uid(preference, uids):
    """Simple function to determine a valid uid which is not part of the uids list

    :param preference: preferred name for the uid
    :type preference: str
    :param uids: list of existing uids
    :type uids: list
    :return: a valid uid which
    :rtype: str
    """
    if preference not in uids:
        uid = preference
    else:
        i = 1
        uid = preference + '_' + str(i)
        while uid in uids:
            i += 1
            uid = preference + '_' + str(i)
    return uid
