def write_biom(biom_tbl, output_fp, fmt="<STR_LIT>", gzip=False):
opener = open<EOL>mode = '<STR_LIT:w>'<EOL>if gzip and fmt != "<STR_LIT>":<EOL><INDENT>if not output_fp.endswith("<STR_LIT>"):<EOL><INDENT>output_fp += "<STR_LIT>"<EOL><DEDENT>opener = gzip_open<EOL>mode = '<STR_LIT>'<EOL><DEDENT>if fmt == "<STR_LIT>":<EOL><INDENT>opener = h5py.File<EOL><DEDENT>gen_str = "<STR_LIT>".format(phylotoast.__version__)<EOL>biom_tbl.generated_by = gen_str<EOL>with opener(output_fp, mode) as biom_f:<EOL><INDENT>if fmt == "<STR_LIT>":<EOL><INDENT>biom_tbl.to_json(biom_tbl.generated_by, direct_io=biom_f)<EOL><DEDENT>elif fmt == "<STR_LIT>":<EOL><INDENT>biom_f.write(biom_tbl.to_tsv())<EOL><DEDENT>else:<EOL><INDENT>biom_tbl.to_hdf5(biom_f, biom_tbl.generated_by)<EOL><DEDENT><DEDENT>return output_fp<EOL>
Write the BIOM table to a file.
:type biom_tbl: biom.table.Table
:param biom_tbl: A BIOM table containing the per-sample OTU counts and metadata
              to be written out to file.
:type output_fp str
:param output_fp: Path to the BIOM-format file that will be written.
:type fmt: str
:param fmt: One of: hdf5, json, tsv. The BIOM version the table will be
            output (2.x, 1.0, 'classic').