def quickslice(*sliceArgs, **sliceKeys):
    """A decorator that allows for an abbreviated slice syntax in function
    arguments: {start:end}. Step is not supported. Valid quickslices are
    dictionaries with a single integer key which has an integer value.

    Arguments can be strings or integers, and indicate the positional or keyword
    arguments that should be checked for possible quickslices. By default, no
    exception is raised if the indicated arguments turn out not to be
    quickslices (consider __getitem__, which can accept slices or integers). To
    change this behavior, set the keyword argument 'argAssert' to True.

    The optional 'argSearch' keyword argument can be True or False, and
    specifies whether or not to check if *every* argument of the decorated
    function is a 'quickslice' rather than just the indicated arguments. The
    default is False.
    """
    argSearch = sliceKeys.get('argSearch', False)
    argAssert = sliceKeys.get('argAssert', False)
    
    def isqslice(arg):
        """Determine if arg is of the proper quickslice form.
        
        Proper quickslice form is a single-element dictionary whose key and
        value are both integers, like: {0:9} (key->start, value->stop)
        """
        return (isinstance(arg, dict) and len(arg) == 1 and
                isinstance(arg.keys()[0], int) and
                isinstance(arg.values()[0], int))
    
    def decorate(f):
        def _wrapper(*args, **kwargs):
            args = list(args)
            if argSearch:
                for i, arg in enumerate(args[:]):
                    if isqslice(arg):
                        start, stop = arg.popitem()
                        args[i] = slice(start, stop)
                for kw, arg in kwargs.iteritems():
                    if isqslice(arg):
                        start, stop = arg.popitem()
                        kwargs[kw] = slice(start, stop)
            elif sliceArgs:
                for arg in sliceArgs:
                    if isinstance(arg, int):
                        try:
                            if isqslice(args[arg]):
                                start, stop = args[arg].popitem()
                                args[arg] = slice(start, stop)
                            elif argAssert:
                                raise ValueError, (
                                    "argument %s expected a quickslice" % arg)
                        except (AttributeError, KeyError, IndexError):
                            pass
                    elif isinstance(arg, basestring):
                        try:
                            if isqslice(kwargs[arg]):
                                start, stop = kwargs[arg].popitem()
                                kwargs[arg] = slice(start, stop)
                            elif argAssert:
                                raise ValueError, (
                                    "argument %s expected a quickslice" % arg)
                        except (AttributeError, KeyError, IndexError):
                            pass
                    else:
                        raise TypeError, (
                            "quickslice expects integers or strings")
            return f(*args, **kwargs)
        return _wrapper
    return decorate
A decorator that allows for an abbreviated slice syntax in function
    arguments: {start:end}. Step is not supported. Valid quickslices are
    dictionaries with a single integer key which has an integer value.

    Arguments can be strings or integers, and indicate the positional or keyword
    arguments that should be checked for possible quickslices. By default, no
    exception is raised if the indicated arguments turn out not to be
    quickslices (consider __getitem__, which can accept slices or integers). To
    change this behavior, set the keyword argument 'argAssert' to True.

    The optional 'argSearch' keyword argument can be True or False, and
    specifies whether or not to check if *every* argument of the decorated
    function is a 'quickslice' rather than just the indicated arguments. The
    default is False.
    
recipes/Python/415500_Quickslice_decorator_Abbreviated_slice/recipe-415500.py