code: def extract_range_list_from_comparison_expr(
      expr: ComparisonExpression, lower_bound: int, upper_bound: int
  ) -> List:
      """Extracts the valid range from the comparison expression.
  
      The expression needs to be amongst <, >, <=, >=, =, !=.
  
      Args:
          expr (ComparisonExpression): comparison expression with two children
              that are leaf expression nodes. If the input does not match,
              the function return False
          lower_bound (int): lower bound of the comparison predicate
          upper_bound (int): upper bound of the comparison predicate
  
      Returns:
          List[Tuple(int)]: list of valid ranges
  
      Raises:
          RuntimeError: Invalid expression
  
      Example:
          extract_range_from_comparison_expr(id < 10, 0, inf): True, [(0,9)]
      """
  
      if not isinstance(expr, ComparisonExpression):
          raise RuntimeError(
              f"Expected Comparison Expression, got {type(expr)}"
          )
      left = expr.children[0]
      right = expr.children[1]
      expr_type = expr.etype
      val = None
      const_first = False
      if isinstance(left, TupleValueExpression) and isinstance(
          right, ConstantValueExpression
      ):
          val = right.value
      elif isinstance(left, ConstantValueExpression) and isinstance(
          right, TupleValueExpression
      ):
          val = left.value
          const_first = True
      else:
          raise RuntimeError(
              f"Only supports extracting range from Comparison Expression \
                  with two children TupleValueExpression and \
                  ConstantValueExpression, got {left} and {right}"
          )
  
      if const_first:
          if expr_type is ExpressionType.COMPARE_GREATER:
              expr_type = ExpressionType.COMPARE_LESSER
          elif expr_type is ExpressionType.COMPARE_LESSER:
              expr_type = ExpressionType.COMPARE_GREATER
          elif expr_type is ExpressionType.COMPARE_GEQ:
              expr_type = ExpressionType.COMPARE_LEQ
          elif expr_type is ExpressionType.COMPARE_LEQ:
              expr_type = ExpressionType.COMPARE_GEQ
  
      valid_ranges = []
      if expr_type == ExpressionType.COMPARE_EQUAL:
          valid_ranges.append((val, val))
      elif expr_type == ExpressionType.COMPARE_NEQ:
          valid_ranges.append((lower_bound, val - 1))
          valid_ranges.append((val + 1, upper_bound))
      elif expr_type == ExpressionType.COMPARE_GREATER:
          valid_ranges.append((val + 1, upper_bound))
      elif expr_type == ExpressionType.COMPARE_GEQ:
          valid_ranges.append((val, upper_bound))
      elif expr_type == ExpressionType.COMPARE_LESSER:
          valid_ranges.append((lower_bound, val - 1))
      elif expr_type == ExpressionType.COMPARE_LEQ:
          valid_ranges.append((lower_bound, val))
      else:
          raise RuntimeError(f"Unsupported Expression Type {expr_type}")
      return valid_ranges
  
file_path: evadb/evadb/expression/expression_utils.py
imports: from typing import List, Set
  from evadb.expression.abstract_expression import AbstractExpression, ExpressionType
  from evadb.expression.comparison_expression import ComparisonExpression
  from evadb.expression.constant_value_expression import ConstantValueExpression
  from evadb.expression.logical_expression import LogicalExpression
  from evadb.expression.tuple_value_expression import TupleValueExpression
label_desc: Use image node_id 3 for calling a global function with example usage: extract_range_list_from_comparison_expr(expr, lower_bound, upper_bound) and returns: valid_ranges