def parse_range(stash_range):
    """
    Parse stash range syntax

    >>> in_range = parse_range('0, 3-5, 8-')
    >>> for i in range(11):
    ...     print('{0} {1}'.format(i, in_range(i)))
    0 True
    1 False
    2 False
    3 True
    4 True
    5 True
    6 False
    7 False
    8 True
    9 True
    10 True

    """

    def minmax(raw):
        if '-' in raw:
            (low, high) = map(str.strip, raw.split('-'))
            return (int(low) if low else 0,
                    int(high) if high else None)
        else:
            return (int(raw), int(raw))

    def in_range(num):
        for (low, high) in ranges:
            if high is None and low <= num:
                return True
            elif low <= num <= high:
                return True
        return False

    if stash_range:
        ranges = list(map(minmax, stash_range.split(',')))
        return in_range
    else:
        return lambda _: True