code: def _nbytes(buf):
      """Return byte-size of a memoryview or buffer"""
      if isinstance(buf, memoryview):
          return buf.nbytes
      else:
          # not a memoryview, raw bytes
          return len(buf)
  
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 1 for calling a global function with example usage: _nbytes(buf) and returns: buf, len