def parse_range(s, range_separator = '-'):
    ''' Parses the string s which contains indices and ranges and returns the explicit list of integers defined by s.
        Written by Laurens Kraal 2014.
    '''
    return reduce(lambda x,y: x+y, (map(lambda r: (range(int(r.split(range_separator)[0]), int(r.split(range_separator)[1])+1)) if range_separator in r else [int(r)], s.split(','))))