BRANCH SP-1043:

  delete kwargs.on_complete and kwargs.on_error only if kwargs is defined