def parse_range(s):
    """
    Parses a string containing an integer or a range of integers.

    Accepts strings such as '123' or '1-20'.
    """
    lims = [int(x) for x in s.split('-')]
    if len(lims) > 2:
        raise ValueError("Expected 'x-y' where x and y are integers. Got %s instead!" % s)
        
    return lims