code: def _frombuffer_rows(
      fid, tag_size, dtype=None, shape=None, rlims=None
  ):
      """Get a range of rows from a large tag."""
      if shape is not None:
          item_size = np.dtype(dtype).itemsize
          if not len(shape) == 2:
              raise ValueError("Only implemented for 2D matrices")
          want_shape = np.prod(shape)
          have_shape = tag_size // item_size
          if want_shape != have_shape:
              raise ValueError(
                  f"Wrong shape specified, requested {want_shape} but got "
                  f"{have_shape}"
              )
          if not len(rlims) == 2:
              raise ValueError("rlims must have two elements")
          n_row_out = rlims[1] - rlims[0]
          if n_row_out <= 0:
              raise ValueError("rlims must yield at least one output")
          row_size = item_size * shape[1]
          # # of bytes to skip at the beginning, # to read, where to end
          start_skip = int(rlims[0] * row_size)
          read_size = int(n_row_out * row_size)
          end_pos = int(fid.tell() + tag_size)
          # Move the pointer ahead to the read point
          fid.seek(start_skip, 1)
          # Do the reading
          out = np.frombuffer(fid.read(read_size), dtype=dtype)
          # Move the pointer ahead to the end of the tag
          fid.seek(end_pos)
      else:
          out = np.frombuffer(fid.read(tag_size), dtype=dtype)
      return out
  
imports: import html
  import re
  import struct
  from dataclasses import dataclass
  from functools import partial
  from typing import Any
  import numpy
  from scipy.sparse import csc_matrix, csr_matrix
  from ..utils import _check_option, warn
  from ..utils.numerics import _julian_to_cal
  from .constants import FIFF, _ch_coil_type_named, _ch_kind_named, _ch_unit_mul_named, _ch_unit_named, _dig_cardinal_named, _dig_kind_named
label_desc: Use image node_id 1 for calling a global function with example usage: _frombuffer_rows(fid, tag_size, dtype, shape, rlims) and returns: out