def _Intersects(range1, range2):
  """Tells if two number ranges intersect.

  Args:
    range1: (tuple(num, num)) tuple representing a range. The
      first number must be <= the second number.
    range2: (tuple(num, num)) tuple representing a range. The
      first number must be <= the second number.

  Returns:
    True if the ranges intersect False otherwise.

  Raises:
    ValueError: if the ranges are invalid.
  """
  if range1[0] > range1[1]:
    raise ValueError('range1 is inverted.')
  if range2[0] > range2[1]:
    raise ValueError('range2 is inverted.')
  return not (range1[1] <= range2[0] or range1[0] >= range2[1])