code: def _serialize_buffer(buffer, array_serialization=None):
      """Serialize a NumPy array."""
      if array_serialization == "binary":
          return buffer.ravel().tobytes()
      elif array_serialization == "base64":
          return {
              "storage_type": "base64",
              "buffer": base64.b64encode(buffer).decode("ascii"),
          }
      raise ValueError(
          "The array serialization method should be 'binary' or "
          "'base64'."
      )
  
imports: import base64
  import logging
  import sys
  import inspect
  import re
  import traceback
  import json
  from functools import partial
  import numpy
label_desc: Use image node_id 5 for calling a global function with example usage: _serialize_buffer(buffer, array_serialization) and returns: buffer, dict