code: def bounce(sequence):
      ''' Return a driver function that can advance a "bounced" sequence
      of values.
  
      .. code-block:: none
  
          seq = [0, 1, 2, 3]
  
          # bounce(seq) => [0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, ...]
  
      Args:
          sequence (seq) : a sequence of values for the driver to bounce
  
      '''
      N = len(sequence)
      def f(i):
          div, mod = divmod(i, N)
          if div % 2 == 0:
              return sequence[mod]
          else:
              return sequence[N-mod-1]
      return partial(force, sequence=_advance(f)f bounce(sequence):
      ''' Return a driver function that can advance a "bounced" sequence
      of values.
  
      .. code-block:: none
  
          seq = [0, 1, 2, 3]
  
          # bounce(seq) => [0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, ...]
  
      Args:
          sequence (seq) : a sequence of values for the driver to bounce
  
      '''
      N = len(sequence)
      def f(i):
          div, mod = divmod(i, N)
          if div % 2 == 0:
              return sequence[mod]
          else:
              return sequence[N-mod-1]
      return partial(force, sequence=_advance(f))
docs: Return a driver function that can advance a "bounced" sequence
      of values.
  
      .. code-block:: none
  
          seq = [0, 1, 2, 3]
  
          # bounce(seq) => [0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, ...]
  
      Args:
          sequence (seq) : a sequence of values for the driver to bounce