code: def print_tree(self, filename, tree=None):
          
          old_stream = self.stream
          self.stream = open(filename, 'w')
          try:
              super(FileBrowser, self).print_tree(tree=tree)
          finally:
              self.stream.close()
              self.stream = old_stream
docs: Print referrers tree to file (in text format).
  
          keyword arguments
          tree -- if not None, the passed tree will be printed.