code: def rectintersect(a, b, norm_intersect_area=None):
      """
      Check for rectangle intersection between rectangles <a> and <b>.
      Return None if no intersection, else return the area of the intersection, optionally normalized/scaled to
      <norm_intersect_area>.
      """
      if a.dtype != b.dtype:
          raise ValueError("dtypes of a and b must match")
  
      if norm_intersect_area not in (None, "a", "b"):
          raise ValueError(
              "norm_intersect_area must be None, 'a' or 'b'"
          )
  
      a_a = rectarea(a)
      a_b = rectarea(b)
  
      if a_a <= 0:
          raise ValueError("Area of a must be > 0")
      if a_b <= 0:
          raise ValueError("Area of b must be > 0")
  
      max_a = min(a_a, a_b)
  
      # deltas per axis
      d = np.empty(4, dtype=a.dtype)
  
      # x
      d[0] = b[1][0] - a[0][0]
      d[1] = a[1][0] - b[0][0]
  
      # y
      d[2] = b[1][1] - a[0][1]
      d[3] = a[1][1] - b[0][1]
  
      if np.sum(d >= 0) == 4:  # intersection
          if norm_intersect_area == "a":
              norm_with = a_a
          elif norm_intersect_area == "b":
              norm_with = a_b
          else:
              norm_with = 1.0
  
          return (
              min(
                  max_a, np.min(np.abs(d[0:2])) * np.min(np.abs(d[2:4]))
              )
              / norm_with
          )
      else:  # no intersection
          return None
  
file_path: pdftabextract/pdftabextract/geom.py
imports: import math
  import numpy
label_desc: Use image node_id 12 for calling a global function with example usage: rectintersect(a, b, norm_intersect_area) and returns: unknown, None