docs: def _serialize(xp_ast):
      '''Generate token strings which, when joined together, form a valid
      XPath serialization of the AST.'''
  
      if hasattr(xp_ast, '_serialize'):
          for tok in xp_ast._serialize():
              yield tok
      elif isinstance(xp_ast, string_types):
          # strings in serialized xpath needed to be quoted
          # (e.g. for use in paths, comparisons, etc)
          # using repr to quote them; for unicode, the leading
          # u (u'') needs to be removed.
          yield repr(xp_ast).lstrip('u')
      else:
          yield str(xp_ast)