import re


def parseRange(text):
    """
    convert a range string like 2-3, 10-20, 4-, -9, or 2 to a list
    containing the endpoints.  A missing endpoint is set to None.
    """
    def toNumeric(elt):
        if elt == "":
            return None
        else:
            return int(elt)

    if re.search(r'-', text):
        rng = text.split(r':')
        rng = [toNumeric(elt) for elt in rng]
    else:
        v = int(text)
        rng = [v, v]

    return rng