code: def canonicalize(path):
      """Makes all paths start at top left, and go clockwise first."""
      # convert args to floats
      path = [[x[0]] + list(map(float, x[1:])) for x in path]
  
      # canonicalize each subpath separately
      new_substructures = []
      for subpath in _separate_substructures(path):
          leftmost_point, leftmost_idx = _get_leftmost_point(subpath)
          reordered = (
              [["M", leftmost_point[0], leftmost_point[1]]]
              + subpath[leftmost_idx + 1 :]
              + subpath[1 : leftmost_idx + 1]
          )
          new_substructures.append((reordered, leftmost_point))
  
      new_path = []
      first_substructure_done = False
      should_flip_cardinality = False
      for sp, _ in sorted(
          new_substructures, key=lambda x: (x[1][1], x[1][0])
      ):
          if not first_substructure_done:
              # we're looking at the first substructure now, we can determine whether we
              # will flip the cardniality of the whole icon or not
              should_flip_cardinality = not _is_clockwise(sp)
              first_substructure_done = True
  
          if should_flip_cardinality:
              sp = _make_clockwise(sp)
  
          new_path.extend(sp)
  
      # convert args to strs
      path = [[x[0]] + list(map(str, x[1:])) for x in new_path]
      return path
  
imports: import io
  import numpy
  from PIL import Image
  from six.moves import zip_longest
  from skimage import draw
  import tensorflow.compat.v1
label_desc: Use image node_id 18 for calling a global function with example usage: canonicalize(path) and returns: path