code: def _max_entropy_cdf(min_x, max_x, x, y, e):
      def compare(x1, y1, x2, y2):
          return x1 * y2 - x2 * y1
  
      new_y = np.full_like(x, 0.0, dtype=np.float64)
      keep = np.full_like(x, False, dtype=np.bool_)
  
      fx = min_x  # fixed x
      fy = 0  # fixed y
      li = 0  # index of lower slope
      ui = 0  # index of upper slope
      ldx = x[li] - fx
      udx = x[ui] - fx
      ldy = y[li + 1] - e - fy
      udy = y[ui] + e - fy
      j = 1
      while ui < len(x) and li < len(x):
          if j == len(x):
              ub = 1
              lb = 1
              xj = max_x
          else:
              ub = y[j] + e
              lb = y[j + 1] - e
              xj = x[j]
          dx = xj - fx
          judy = ub - fy
          jldy = lb - fy
          if compare(ldx, ldy, dx, judy) < 0:
              # line must bend down at j
              fx = x[li]
              fy = y[li + 1] - e
              new_y[li] = fy
              keep[li] = True
              j = li + 1
              if j >= len(x):
                  break
              li = j
              ldx = x[li] - fx
              ldy = y[li + 1] - e - fy
              ui = j
              udx = x[ui] - fx
              udy = y[ui] + e - fy
              j += 1
              continue
          elif compare(udx, udy, dx, jldy) > 0:
              # line must bend up at j
              fx = x[ui]
              fy = y[ui] + e
              new_y[ui] = fy
              keep[ui] = True
              j = ui + 1
              if j >= len(x):
                  break
              li = j
              ldx = x[li] - fx
              ldy = y[li + 1] - e - fy
              ui = j
              udx = x[ui] - fx
              udy = y[ui] + e - fy
              j += 1
              continue
          if j >= len(x):
              break
          if compare(udx, udy, dx, judy) < 0:
              ui = j
              udx = x[ui] - fx
              udy = y[ui] + e - fy
          if compare(ldx, ldy, dx, jldy) > 0:
              li = j
              ldx = x[li] - fx
              ldy = y[li + 1] - e - fy
          j += 1
      return new_y, keep
  
imports: import math
  import collections
  import numpy
  import pandas
  import bokeh
  import bokeh.io
  import bokeh.models
  import warnings
  from bokeh.models import HoverTool, ColorBar, LogTicker, LogColorMapper, LinearColorMapper, CategoricalColorMapper, ColumnDataSource, BasicTicker, Plot, CDSView, GroupFilter, IntersectionFilter, Legend, LegendItem, Renderer, CustomJS, Select, Column, Span, DataRange1d, Slope, Label, ColorMapper, GridPlot
  import bokeh.plotting
  import bokeh.palettes
  from bokeh.plotting import figure
  from bokeh.transform import transform
  from bokeh.layouts import gridplot
  from hail.expr import aggregators
  from hail.expr.expressions import Expression, NumericExpression, StringExpression, LocusExpression, Int32Expression, Int64Expression, Float32Expression, Float64Expression, expr_numeric, expr_float64, expr_any, expr_locus, expr_str, raise_unless_row_indexed
  from hail.expr.functions import _error_from_cdf_python
  from hail.typecheck import typecheck, oneof, nullable, sized_tupleof, numeric, sequenceof, dictof
  from hail import Table, MatrixTable
  from hail.utils.struct import Struct
  from hail.utils.java import warning
  from typing import List, Tuple, Dict, Union, Callable, Optional, Sequence, Any, Set
  import hail
label_desc: Use image node_id 5 for calling a global function with example usage: _max_entropy_cdf(min_x, max_x, x, y, e) and returns: new_y,  keep, unknown