def parse_slice(useslice):
    """Parses the argument string "useslice" as the arguments to the `slice()`
    constructor and returns a slice object that's been instantiated with those
    arguments. i.e. input useslice="1,20,2" leads to output `slice(1, 20, 2)`.
    """
    try:
        l = {}
        exec("sl = slice(%s)" % useslice, l)
        return l['sl']
    except Exception:
        msg = ("Expected arguments consumable by 'slice' to follow "
                "option `-j`, found '%s'" % useslice)
        raise ValueError(msg)