def parse_index(index_str):
    """ index or start:stop:step (all ints) """
    if ':' in index_str:
        s = index_str.split(':')
        s = list(map(lambda i: int(i) if len(i) > 0 else None, s))
        return slice(*s)
    return int(index_str)
