code: def rint(x, step=1):
    
    div, mod = divmod(x, step)
    err = min(step / 10., .1)
    result = div * step
    if x > 0:
      result += err
    elif x < 0:
      result -= err
    if (operator.ge if x >= 0 else operator.gt)(2 * mod, step):
      result += step
    return int(result)
docs: Round to integer.
  
    Parameters
    ----------
    x :
      Input number (integer or float) to be rounded.
    step :
      Quantization level (defaults to 1). If set to 2, the output will be the
      "best" even number.
  
    Result
    ------
    The step multiple nearest to x. When x is exactly halfway between two
    possible outputs, it'll result the one farthest to zero.