docs: def write_tree_newick(self, filename, hide_rooted_prefix=False):
          '''Write this ``Tree`` to a Newick file
  
          Args:
              ``filename`` (``str``): Path to desired output file (plain-text or gzipped)
          '''
          if not isinstance(filename, str):
              raise TypeError("filename must be a str")
          treestr = self.newick()
          if hide_rooted_prefix:
              if treestr.startswith('[&R]'):
                  treestr = treestr[4:].strip()
              else:
                  warn("Specified hide_rooted_prefix, but tree was not rooted")
          if filename.lower().endswith('.gz'): # gzipped file
              f = gopen(expanduser(filename),'wb',9); f.write(treestr.encode()); f.close()
          else: # plain-text file
              f = open(expanduser(filename),'w'); f.write(treestr); f.close()