code: def sort_points(points):
      # TODO Add typehints & test & docstring
      """Sort arbitrary points in clockwise order in Cartesian coordinate, you
      may need to reverse the output sequence if you are using OpenCV's image
      coordinate.
  
      Reference:
      https://github.com/novioleo/Savior/blob/master/Utils/GeometryUtils.py.
  
      Warning: This function can only sort convex polygons.
  
      Args:
          points (list[ndarray] or ndarray or list[list]): A list of unsorted
              boundary points.
  
      Returns:
          list[ndarray]: A list of points sorted in clockwise order.
      """
      assert (
          is_list_of(points, np.ndarray)
          or isinstance(points, np.ndarray)
          or is_2dlist(points)
      )
      center_point = tuple(
          map(
              operator.truediv,
              reduce(lambda x, y: map(operator.add, x, y), points),
              [len(points)] * 2,
          )
      )
      return sorted(
          points,
          key=lambda coord: (
              180
              + math.degrees(
                  math.atan2(
                      *tuple(map(operator.sub, coord, center_point))
                  )
              )
          )
          % 360,
      )
  
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 15 for calling a global function with example usage: sort_points(points) and returns: sorted