code: def bezier_radialrange(seg, origin, return_all_global_extrema=False):
      
  
      def _radius(tau):
          return abs(seg.point(tau) - origin)
  
      shifted_seg_poly = seg.poly() - origin
      r_squared = real(shifted_seg_poly) ** 2 + \
                  imag(shifted_seg_poly) ** 2
      extremizers = [0, 1] + polyroots01(r_squared.deriv())
      extrema = [(_radius(t), t) for t in extremizers]
  
      if return_all_global_extrema:
          raise NotImplementedError
      else:
          seg_global_min = min(extrema, key=itemgetter(0))
          seg_global_max = max(extrema, key=itemgetter(0))
          return seg_global_min, seg_global_max
docs: returns the tuples (d_min, t_min) and (d_max, t_max) which minimize and
      maximize, respectively, the distance d = |self.point(t)-origin|.
      return_all_global_extrema:  Multiple such t_min or t_max values can exist.
      By default, this will only return one. Set return_all_global_extrema=True
      to return all such global extrema.