class_docstr: A canned bytes object.
class_docstr_tok: ["A","canned","bytes","object","."]
docstr: Cast a buffer or memoryview object to bytes
docstr_tok: ["Cast","a","buffer","or","memoryview","object","to","bytes"]
code: def wrap(
      buf: typing.Union[memoryview, bytes, typing.SupportsBytes]
  ) -> bytes:
      """Cast a buffer or memoryview object to bytes"""
      if isinstance(buf, memoryview):
          return buf.tobytes()
      if not isinstance(buf, bytes):
          return bytes(buf)
      return buf
  
imports: import typing
  import warnings
  import copy
  import pickle
  import sys
  from types import FunctionType
  from ipyparallel.serialize import codeutil
  from traitlets.log import get_logger
  from traitlets.utils.importstring import import_item
label_desc: Use image node_id 1 for calling the CannedBytes obj's underlying member method code with example usage: obj.wrap(buf) and returns: buf, buf, bytes