from typing import Type
from typing import Any


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

  class _NewClass(cls):

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

  return _NewClass