code: def occur_check(var, x, s):
      
      if var == x:
          return True
      elif is_variable(x) and x in s:
          return occur_check(var, s[x], s)
      elif isinstance(x, Expr):
          return (occur_check(var, x.op, s) or
                  occur_check(var, x.args, s))
      elif isinstance(x, (list, tuple)):
          return some(lambda element: occur_check(var, element, s), x)
      else:
          return False
docs: Return true if variable var occurs anywhere in x
      (or in subst(s, x), if s has a binding for x).