code: def read_chunk(stream):
      """Read a byte chunk from a stream with magics, length, and padding."""
      magic = stream.read(8)
      if magic == b"":
          return None
      if magic != magic_bytes:
          raise ValueError("magic number does not match")
      nbytes = stream.read(8)
      nbytes = struct.unpack("@q", nbytes)[0]
      if nbytes < 0:
          raise ValueError("negative nbytes")
      data = stream.read(nbytes)
      padding = roundup(nbytes) - nbytes
      if padding > 0:
          stream.read(padding)
      return data
  
imports: import struct
  import sys
  import numpy
label_desc: Use image node_id 17 for calling a global function with example usage: read_chunk(stream) and returns: data, None