code: def pattern_convert(grammar, raw_node_info):
      
      type, value, context, children = raw_node_info
      if children or type in grammar.number2symbol:
          return pytree.Node(type, children, context=context)
      else:
          return pytree.Leaf(type, value, context=context)
docs: Converts raw node information to a Node or Leaf instance.