def getSlotsRange(slots):
    """I failed the programming interview quizz but the function
       works like redis CLUSTER NODES
    """
    if len(slots) == 0:
        return ''
    ranges = []
    equal = False
    firstSlot = slots[0]
    for i in range(1, len(slots)):
        if slots[i - 1] + 1 == slots[i]:
            if i == len(slots) - 1:
                ranges.append((firstSlot, slots[i]))
            continue
        else:
            equal = False
            ranges.append((firstSlot, slots[i - 1]))
            firstSlot = slots[i]
        if i == len(slots) - 1:
            if not equal:
                ranges.append((slots[i], slots[i]))
            else:
                ranges.append((firstSlot, slots[i]))
    res = []
    for r in ranges:
        if r[0] == r[1]:
            res.append(str(r[0]))
        else:
            res.append('{}-{}'.format(r[0], r[1]))
    return ' '.join(res)
