'Returns a tuple (units, list), where list is a sequence of
(begin, end) tuples; and end is None if it was not provided.'

def parse(self, *args, **kwargs):

    value = self.__call__(*args, **kwargs)
    if (not value):
        return None
    ranges = []
    last_end = (-1)
    try:
        (units, range) = value.split('=', 1)
        units = units.strip().lower()
        for item in range.split(','):
            (begin, end) = item.split('-')
            if (not begin.strip()):
                begin = 0
            else:
                begin = int(begin)
            if (begin <= last_end):
                raise ValueError()
            if (not end.strip()):
                end = None
            else:
                end = int(end)
            last_end = end
            ranges.append((begin, end))
    except ValueError:
        return None
    return (units, ranges)
