class_docstr: A small helper class to read fields stored in JPEG2000 header boxes
  and to easily step into and read sub-boxes.
class_docstr_tok: ["A","small","helper","class","to","read","fields","stored","in","JPEG2000","header","boxes","and","to","easily","step","into","and","read","sub-boxes","."]
code: def _read_bytes(self, num_bytes):
      if not self._can_read(num_bytes):
          msg = "Not enough data in header"
          raise SyntaxError(msg)
  
      data = self.fp.read(num_bytes)
      if len(data) < num_bytes:
          msg = f"Expected to read {num_bytes} bytes but only got {len(data)}."
          raise OSError(msg)
  
      if self.remaining_in_box > 0:
          self.remaining_in_box -= num_bytes
      return data
  
imports: import io
  import os
  import struct
  from .None import Image, ImageFile, _binary
label_desc: Use image node_id 3 for calling the BoxReader obj's underlying member method code with example usage: obj._read_bytes(num_bytes) and returns: data