def _safe_divide(a: int, b: int):
  """Divides a and b as a/b if 0 < a <= b. Otherwise, raises ValueError.

  Args:
    a: Numerator.
    b: Denominator.

  Returns:
    Float of division result.
  """

  if a < 0:
    raise ValueError('a ({}) < 0'.format(a))
  elif a > b:
    raise ValueError('a ({}) > b ({})'.format(a, b))

  return a / b