def as_slice(slice_):
if isinstance(slice_, (Integral, numpy.integer, type(None))):<EOL><INDENT>return slice(<NUM_LIT:0>, None, <NUM_LIT:1>)<EOL><DEDENT>if isinstance(slice_, (slice, numpy.ndarray)):<EOL><INDENT>return slice_<EOL><DEDENT>if isinstance(slice_, (list, tuple)):<EOL><INDENT>return tuple(map(as_slice, slice_))<EOL><DEDENT>raise TypeError("<STR_LIT>".format(slice_))<EOL>
Convert an object to a slice, if possible