code: def raises_gathered(error_type):
      '''For use in tests. Many tests expect a single error to be thrown, and
      want it to be of a specific type. This is a helper method for when that
      type is inside a gathered exception.'''
      container = RaisesGatheredContainer()
      try:
          yield container
      except GatheredExceptions as e:
          # Make sure there is exactly one exception.
          if len(e.exceptions) != 1:
              raise
          inner = e.exceptions[0]
          # Make sure the exception is the right type.
          if not isinstance(inner, error_type):
              raise
          # Success.
          container.exception = innef raises_gathered(error_type):
      '''For use in tests. Many tests expect a single error to be thrown, and
      want it to be of a specific type. This is a helper method for when that
      type is inside a gathered exception.'''
      container = RaisesGatheredContainer()
      try:
          yield container
      except GatheredExceptions as e:
          # Make sure there is exactly one exception.
          if len(e.exceptions) != 1:
              raise
          inner = e.exceptions[0]
          # Make sure the exception is the right type.
          if not isinstance(inner, error_type):
              raise
          # Success.
          container.exception = inner
docs: For use in tests. Many tests expect a single error to be thrown, and
      want it to be of a specific type. This is a helper method for when that
      type is inside a gathered exception.