code: def _extract_buffers(obj, threshold=MAX_BYTES):
      """extract buffers larger than a certain threshold"""
      buffers = []
      if isinstance(obj, CannedObject) and obj.buffers:
          for i, buf in enumerate(obj.buffers):
              nbytes = _nbytes(buf)
              if nbytes > threshold:
                  # buffer larger than threshold, prevent pickling
                  obj.buffers[i] = None
                  buffers.append(buf)
              # buffer too small for separate send, coerce to bytes
              # because pickling buffer objects just results in broken pointers
              elif isinstance(buf, memoryview):
                  obj.buffers[i] = buf.tobytes()
      return buffers
  
file_path: ipyparallel/ipyparallel/serialize/serialize.py
imports: from itertools import chain
  from jupyter_client.session import MAX_BYTES, MAX_ITEMS
  from .canning import CannedObject, can, can_sequence, istype, sequence_types, uncan, uncan_sequence
label_desc: Use image node_id 2 for calling a global function with example usage: _extract_buffers(obj, threshold) and returns: buffers