code: def _pretty_print_lark_trees(tree, indent=0, show_expr=True):
      if isinstance(tree, _lark.Token):
          return tree.value
  
      data = str(tree.data)
  
      is_expr = data.startswith("expression")
  
      if is_expr:
          data = re.sub(r"^expression", "E", data)
  
      is_ambig = data == "_ambig"
  
      if is_ambig:
          new_indent = indent + 2
      else:
          new_indent = indent
  
      output = ""
      show_node = not is_expr or show_expr
  
      if show_node:
          output += str(data) + "("
  
      if is_ambig:
          output += "\n" + "\n".join(
              [
                  " " * new_indent
                  + _pretty_print_lark_trees(i, new_indent, show_expr)
                  for i in tree.children
              ]
          )
      else:
          output += ",".join(
              [
                  _pretty_print_lark_trees(i, new_indent, show_expr)
                  for i in tree.children
              ]
          )
  
      if show_node:
          output += ")"
  
      return output
  
file_path: sympy/sympy/parsing/latex/lark/latex_parser.py
imports: import os
  import logging
  import re
  from sympy.external import import_module
  from sympy.parsing.latex.lark.transformer import TransformToSymPyExpr
label_desc: Use image node_id 2 for calling a global function with example usage: _pretty_print_lark_trees(tree, indent, show_expr) and returns: output, tree