code: def replace_all(buffer, replacements):
      """Substitute multiple replacement values into a buffer.
  
      Replacements is a list of (start, end, value) triples.
      """
  
      result = bytearray()
      prev = 0
      offset = 0
      for u, v, r in replacements:
          result.extend(buffer[prev:u])
          result.extend(r)
          prev = v
          offset += len(r) - (v - u)
      result.extend(buffer[prev:])
      assert len(result) == len(buffer) + offset
      return hbytes(result)
  
imports: from __future__ import absolute_import, division, print_function
  from hypothesis.internal.compat import array_or_list, hbytes, int_to_bytes, integer_types
label_desc: Use image node_id 1 for calling a global function with example usage: replace_all(buffer, replacements) and returns: hbytes