import re


def get_slice_obj_from_str(slicearg):
    """Given a string that looks like a slice, return an actual slice object.
    This is used to let command line arguments specify slices.

    There is a wonky bit w/ argparse that conflicts with starting
    negative values. I keep forgetting to document the work around...

    """
    slicearg = re.sub(',','',slicearg)
    svals = [ int(n) if n else None for n in slicearg.split(':') ]
    svals = tuple(svals)
    s = slice(*svals)
    return s