code: def rect(lefttop, rightbottom):
      """
      create a rectangle structure from top left and bottom right point.
      :param leftop: np.array from pt()
      :param rightbottom: np.array from pt()
      :return 2x2 np.array matrix, first row is top left point, second row is bottom right point
      """
      if lefttop.dtype != rightbottom.dtype:
          raise ValueError(
              "dtypes of lefttop and rightbottom must match"
          )
  
      if lefttop[0] >= rightbottom[0]:
          raise ValueError(
              "lefttop[0] must be smaller than rightbottom[0] to form a rectangle"
          )
  
      if lefttop[1] >= rightbottom[1]:
          raise ValueError(
              "lefttop[1] must be smaller than rightbottom[1] to form a rectangle"
          )
  
      return np.array((lefttop, rightbottom), dtype=lefttop.dtype)
  
file_path: pdftabextract/pdftabextract/geom.py
imports: import math
  import numpy
label_desc: Use image node_id 7 for calling a global function with example usage: rect(lefttop, rightbottom) and returns: np