def wrap_optimizer(cls, **default_kwargs):
  """Wraps an optimizer such that __init__ uses the specified kwargs."""

  class WrapperUnrolledOptimizer(cls):

    def __init__(self, *args, **kwargs):
      new_kwargs = default_kwargs.copy()
      new_kwargs.update(kwargs)
      super(WrapperUnrolledOptimizer, self).__init__(*args, **new_kwargs)
  return WrapperUnrolledOptimizer