code: def expr_items(expr):
      
  
      res = set()
  
      def rec(subexpr):
          if subexpr.__class__ is tuple:
              # AND, OR, NOT, or relation
  
              rec(subexpr[1])
  
              # NOTs only have a single operand
              if subexpr[0] is not NOT:
                  rec(subexpr[2])
  
          else:
              # Symbol or choice
              res.add(subexpr)
  
      rec(expr)
      return res
docs: Returns a set() of all items (symbols and choices) that appear in the
      expression 'expr'.