def split_int_colon(modes, nmax=1000):
    """
    Uses numpy-ish syntax to parse a set of integers.  Values are inclusive.
    Blanks are interpreted as 0.

    Parse the following:
       1:10
       1:
       :100
       1:5:2
       :5,11:15:2,10:20
    """
    modes2 = []
    if modes is not None:
        smodes = modes.strip().split(',')
        for mode in smodes:
            mode = mode.strip()
            if ':' in mode:
                smode = mode.split(':')
                if len(smode) == 2:
                    if smode[0] == '':
                        smode[0] = 0
                    istart = int(smode[0])
                    if smode[1] == '':
                        iend = None
                        modes2 = slice(istart, nmax)
                        assert len(smodes) == 1, smodes
                    else:
                        iend = int(smode[1])
                        assert iend > istart, 'smode=%s; istart=%s iend=%s' % (
                            smode, istart, iend)
                        modes2 += list(range(istart, iend + 1))
                elif len(smode) == 3:
                    istart = int(smode[0])
                    iend = int(smode[1])
                    assert iend > istart, 'smode=%s; istart=%s iend=%s' % (
                        smode, istart, iend)
                    istep = int(smode[2])
                    modes2 += list(range(istart, iend + 1, istep))
                else:
                    raise NotImplementedError('smode=%r; len=%s' % (smode,
                        len(smode)))
            else:
                imode = int(mode)
                modes2.append(imode)
        modes = modes2
    try:
        modes.sort()
    except AttributeError:
        pass
    return modes
