code: def find_bezier_t_intersecting_with_closedpath(
      bezier_point_at_t,
      inside_closedpath,
      t0=0.0,
      t1=1.0,
      tolerence=0.01,
  ):
      """Find a parameter t0 and t1 of the given bezier path which
      bounds the intersecting points with a provided closed
      path(*inside_closedpath*). Search starts from *t0* and *t1* and it
      uses a simple bisecting algorithm therefore one of the end point
      must be inside the path while the orther doesn't. The search stop
      when |t0-t1| gets smaller than the given tolerence.
      value for
  
      - bezier_point_at_t : a function which returns x, y coordinates at *t*
  
      - inside_closedpath : return True if the point is inside the path
  
      """
      # inside_closedpath : function
  
      start = bezier_point_at_t(t0)
      end = bezier_point_at_t(t1)
  
      start_inside = inside_closedpath(start)
      end_inside = inside_closedpath(end)
  
      if start_inside == end_inside and start != end:
          raise NonIntersectingPathException(
              "Both points are on the same side of the closed path"
          )
  
      while True:
          # return if the distance is smaller than the tolerence
          if np.hypot(start[0] - end[0], start[1] - end[1]) < tolerence:
              return t0, t1
  
          # calculate the middle point
          middle_t = 0.5 * (t0 + t1)
          middle = bezier_point_at_t(middle_t)
          middle_inside = inside_closedpath(middle)
  
          if xor(start_inside, middle_inside):
              t1 = middle_t
              end = middle
              end_inside = middle_inside
          else:
              t0 = middle_t
              start = middle
              start_inside = middle_inside
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import six
  import numpy
  from matplotlib.path import Path
  from operator import xor
  import warnings
label_desc: Use image node_id 5 for calling a global function with example usage: find_bezier_t_intersecting_with_closedpath(bezier_point_at_t, inside_closedpath, t0, t1, tolerence) and returns: t0,  t1