code: def bisect_fun(fun: Callable, target: float, lo: int, hi: int) -> int:
      """
      Bisection algorithm for function evaluation with integer support.
  
      Assumes the function is non-decreasing on the interval `[lo, hi]`.
      Return an integer value v such that for all `x<v, fun(x)<target` and for all `x>=v, fun(x)>=target`.
      This is equivalent to the library function `bisect.bisect_left` but for functions defined on integers.
  
      Parameters
      ----------
      fun
          A function defined on integers in the range `[lo, hi]` and returning floats.
      target
          Target value to be searched for.
      lo
          Lower bound of the domain.
      hi
          Upper bound of the domain.
  
      Returns
      -------
      Integer index.
  
      """
      while lo < hi:
          mid = (lo + hi) // 2
          if fun(mid) < target:
              lo = mid + 1
          else:
              hi = mid
      return lo
  
imports: import copy
  import math
  import numpy
  import pandas
  from itertools import count
  from functools import partial
  from typing import Callable, List, Optional, Tuple, Union, Dict, TYPE_CHECKING, no_type_check
  import sys
  import logging
  from alibi.api.interfaces import Explainer, Explanation
  from alibi.api.defaults import DEFAULT_META_ALE, DEFAULT_DATA_ALE
label_desc: Use image node_id 2 for calling a global function with example usage: bisect_fun(fun, target, lo, hi) and returns: lo