code: def create_obj_patch(
      geometry: Union[BoundingBox, Polygon4P, np.ndarray],
      page_dimensions: Tuple[int, int],
      **kwargs: Any,
  ) -> patches.Patch:
      """Create a matplotlib patch for the element
  
      Args:
      ----
          geometry: bounding box (straight or rotated) of the element
          page_dimensions: dimensions of the page in format (height, width)
          **kwargs: keyword arguments for the patch
  
      Returns:
      -------
          a matplotlib Patch
      """
      if isinstance(geometry, tuple):
          if len(geometry) == 2:  # straight word BB (2 pts)
              return rect_patch(geometry, page_dimensions, **kwargs)
          elif len(geometry) == 4:  # rotated word BB (4 pts)
              return polygon_patch(
                  np.asarray(geometry), page_dimensions, **kwargs
              )
      elif isinstance(geometry, np.ndarray) and geometry.shape == (
          4,
          2,
      ):  # rotated line
          return polygon_patch(geometry, page_dimensions, **kwargs)
      raise ValueError("invalid geometry format")
  
imports: import colorsys
  from copy import deepcopy
  from typing import Any, Dict, List, Optional, Tuple, Union
  import cv2
  import matplotlib.patches
  import matplotlib.pyplot
  import mplcursors
  import numpy
  from matplotlib.figure import Figure
  from PIL import Image, ImageDraw
  from unidecode import unidecode
  from .common_types import BoundingBox, Polygon4P
  from .fonts import get_font
label_desc: Use image node_id 3 for calling a global function with example usage: create_obj_patch(geometry, page_dimensions) and returns: rect_patch, polygon_patch, polygon_patch