code: def flatten_buffer(
      b: bytes | bytearray | memoryview | PickleBuffer,
  ) -> bytes | bytearray | memoryview:
      """
      Return some 1-D `uint8` typed buffer.
  
      Coerces anything that does not match that description to one that does
      without copying if possible (otherwise will copy).
      """
  
      if isinstance(b, (bytes, bytearray)):
          return b
  
      if not isinstance(b, PickleBuffer):
          b = PickleBuffer(b)
  
      try:
          # coerce to 1-D `uint8` C-contiguous `memoryview` zero-copy
          return b.raw()
      except BufferError:
          # perform in-memory copy if buffer is not contiguous
          return memoryview(b).tobytes("A")
  
label_desc: Use image node_id 1 for calling a global function with example usage: flatten_buffer(b) and returns: b, b, memoryview