import _ast


def CompareOpMap(operator):
  """Maps operator strings for boolean operations to their _ast node."""
  op_dict = {
      '==': _ast.Eq,
      '!=': _ast.NotEq,
      '<': _ast.Lt,
      '<=': _ast.LtE,
      '>': _ast.Gt,
      '>=': _ast.GtE,
      'is': _ast.Is,
      'is not': _ast.IsNot,
      'in': _ast.In,
      'not in': _ast.NotIn,
  }

  return op_dict[operator]()