This function is basically a beefed up lambda x: func(x, *args, **kwargs)

    :func:`shift` comes in handy when it is used in a pipeline with a function that
    needs the passed value as its first argument.

    :param func: a function
    :param args: objects
    :param kwargs: keywords

    >>> def div(x, y): return float(x) / y

    This is equivalent to div(42, 2)::

        >>> shift(div, 2)(42)
        21.0

    which is different from div(2, 42)::

        >>> from functools import partial
        >>> partial(div, 2)(42)
        0.047619047619047616

def shift(func, *args, **kwargs):
    """This function is basically a beefed up lambda x: func(x, *args, **kwargs)

    :func:`shift` comes in handy when it is used in a pipeline with a function that
    needs the passed value as its first argument.

    :param func: a function
    :param args: objects
    :param kwargs: keywords

    >>> def div(x, y): return float(x) / y

    This is equivalent to div(42, 2)::

        >>> shift(div, 2)(42)
        21.0

    which is different from div(2, 42)::

        >>> from functools import partial
        >>> partial(div, 2)(42)
        0.047619047619047616

    """
    @wraps(func)
    def wrapped(x):
        return func(x, *args, **kwargs)
    return wrapped