<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _write( df, filename=None, schema='newick', taxon_col='uid', taxon_annotations=[], node_col='uid', node_annotations=[], branch_lengths=True, **kwargs ):
 """Write a phylopandas tree DataFrame to various formats. Parameters df : DataFrame DataFrame containing tree data. filename : str filepath to write out tree. If None, will return string. schema : str tree format to write out. taxon_col : str (optional) Column in dataframe to label the taxon. If None, the index will be used. taxon_annotations : str List of columns to annotation in the tree taxon. node_col : str (optional) Column in dataframe to label the nodes. If None, the index will be used. node_annotations : str List of columns to annotation in the node taxon. branch_lengths : bool If True, inclues branch lengths. """

    tree = _pandas_df_to_dendropy_tree(
        df,
        taxon_col=taxon_col,
        taxon_annotations=taxon_annotations,
        node_col=node_col,
        node_annotations=node_annotations,
        branch_lengths=branch_lengths,
    )

    # Write out format
    print(schema)
    if filename is not None:
        tree.write(path=filename, schema=schema, suppress_annotations=False, **kwargs)
    else:
        return tree.as_string(schema=schema)