def partialr(func, *args, **kwargs):
    """partialr: Partially applies last arguments.
    New keyworded arguments extend and override kwargs."""
    return lambda *a, **kw: func(*(a + args), **dict(kwargs, **kw))