code: def _binary_search(f, xmin, xmax, eps=1e-9):
      
      middle = (xmax + xmin) / 2.
      while xmax - xmin > eps:
          assert xmin < xmax
          middle = (xmax + xmin) / 2.
          if f(xmax):
              return xmax
          if not f(xmin):
              return xmin
          if f(middle):
              xmin = middle
          else:
              xmax = middle
      return middle
docs: Return the largest x such f(x) is True.