def make_valid_index(list_wid):
    """
    Returns a valid new index for the given list widget `list_wid`
    """
    lowest_allowed = 0
    if str(list_wid.objectName()) == 'listActions':
        lowest_allowed = 1
    for i in range(lowest_allowed, 31):
        valid = True
        for row in range(0, list_wid.count()):
            if int(str(list_wid.item(row).text()).split()[0]) == i:
                valid = False
        if valid is True:
            return i
