import random


def _get_new_label(current, lowLim=1000, highLim=10000, maxIt = 1000000):
    """
    generates a random number that is between limits and not in current list

    Parameters
    -----------
    current: list of current labels
    lowlim: int, optional
        lower limit for random integers generated
    highlim: int, optional
        high limit for random integers generated
    maxIt: int, optional
        max iterations before None is returned for the new label

    Returns
    -------
    random integer between lowLim and highLim not in current list
    """
    label = random.randint(lowLim, highLim)
    it = 0
    while label in current:
        label = random.randint(lowLim, highLim)
        it += 1
        if it > maxIt:
            return None
    return label