code: def shapely2poly(polygon: Polygon) -> np.array:
      """Convert a nested list of boundaries to a list of Polygons.
  
      Args:
          polygon (Polygon): A polygon represented by shapely.Polygon.
  
      Returns:
          np.array: Converted numpy array
      """
      return np.array(polygon.exterior.coords).reshape(
          -1,
      )
  
imports: import math
  import operator
  from functools import reduce
  from typing import List, Optional, Sequence, Tuple, Union
  import numpy
  import pyclipper
  import shapely
  from mmengine.utils import is_list_of
  from shapely.geometry import MultiPolygon, Polygon
  from mmocr.utils import bbox2poly, valid_boundary
  from mmocr.utils.check_argument import is_2dlist
  from mmocr.utils.typing_utils import ArrayLike
label_desc: Use image node_id 6 for calling a global function with example usage: shapely2poly(polygon) and returns: np