code: def maybe_show_tree(walker, ast):
      
      if walker.showast:
          if hasattr(walker.showast, 'write'):
              stream = walker.showast
          else:
              stream = sys.stdout
          if walker.showast == 'Full':
              walker.str_with_template(ast)
          else:
              stream.write(str(ast))
          stream.write('\n')
docs: Show the ast based on the showast flag (or file object), writing to the
      appropriate stream depending on the type of the flag.
  
      :param show_tree: Flag which determines whether the parse tree is
                        written to sys.stdout or not. (It is also to pass a file
                        like object, into which the ast will be written).
      :param ast:     The ast to show.