def partialclass(cls, *base_args, **base_kwargs):
  """Builds a subclass with partial application of the given args and keywords.

  Equivalent to functools.partial performance, base_args are preprended to the
  positional arguments given during object initialization and base_kwargs are
  updated with the kwargs given later.

  Args:
    cls: The base class.
    *base_args: Positional arguments to be applied to the subclass.
    **base_kwargs: Keyword arguments to be applied to the subclass.

  Returns:
    A subclass of the input class.

  Author: Joan Puigcerver (jpuigcerver@)
  """

  class _NewClass(cls):

    def __init__(self, *args, **kwargs):
      bound_args = base_args + args
      bound_kwargs = base_kwargs.copy()
      bound_kwargs.update(kwargs)
      super(_NewClass, self).__init__(*bound_args, **bound_kwargs)

  return _NewClass