<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def defaults_scope(**kwargs):
 """Creates a scope for the defaults that are used in a `with` block. Note: `defaults_scope` supports nesting where later defaults can be overridden. Also, an explicitly given keyword argument on a method always takes precedence. In addition to setting defaults for some methods, this also can control: * `summary_collections`: Choose which collection to place summaries in or disable with `None`. * `trainable_variables`: Boolean indicating if variables are trainable. * `variable_collections`: Default collections in which to place variables; `tf.GraphKeys.GLOBAL_VARIABLES` is always included. Args: **kwargs: The defaults. Yields: Doesn't really yield, instead this creates a Context Manager for use in a `with` statement. Raises: ValueError: if a collection type is accidently supplied a string. """

  _assert_value_not_string('summary_collections', kwargs)
  _assert_value_not_string('variable_collections', kwargs)

  _check_defaults(kwargs)
  global _defaults
  old_defaults = _defaults
  _defaults = chain_dict.ChainDict(_defaults)
  _defaults.update(kwargs)

  # Special logic to support summary_collections.
  # This is added here because introducing more scopes would add more confusion
  # than overloading this one a bit.
  books = bookkeeper.for_default_graph()
  if 'summary_collections' in _defaults:
    books.summary_collections = _defaults['summary_collections']
  else:
    books.reset_summary_collections()
  try:
    yield _defaults
  finally:
    _defaults = old_defaults