def write(gctoo, out_fname, data_null="NaN", metadata_null="-666", filler_null="-666", data_float_format="%.4f"):
    """Write a gctoo object to a gct file.

    Args:
        gctoo (gctoo object)
        out_fname (string): filename for output gct file
        data_null (string): how to represent missing values in the data (default = "NaN")
        metadata_null (string): how to represent missing values in the metadata (default = "-666")
        filler_null (string): what value to fill the top-left filler block with (default = "-666")
        data_float_format (string): how many decimal points to keep in representing data
            (default = 4 digits; None will keep all digits)

    Returns:
        None

    """
    # Create handle for output file
    if not out_fname.endswith(".gct"):
        out_fname += ".gct"
    f = open(out_fname, "w")

    # Write first two lines
    dims = [str(gctoo.data_df.shape[0]), str(gctoo.data_df.shape[1]),
            str(gctoo.row_metadata_df.shape[1]), str(gctoo.col_metadata_df.shape[1])]
    write_version_and_dims(VERSION, dims, f)

    # Write top half of the gct
    write_top_half(f, gctoo.row_metadata_df, gctoo.col_metadata_df,
                   metadata_null, filler_null)

    # Write bottom half of the gct
    write_bottom_half(f, gctoo.row_metadata_df, gctoo.data_df,
                      data_null, data_float_format, metadata_null)

    f.close()
    logger.info("GCT has been written to {}".format(out_fname))
Write a gctoo object to a gct file.

    Args:
        gctoo (gctoo object)
        out_fname (string): filename for output gct file
        data_null (string): how to represent missing values in the data (default = "NaN")
        metadata_null (string): how to represent missing values in the metadata (default = "-666")
        filler_null (string): what value to fill the top-left filler block with (default = "-666")
        data_float_format (string): how many decimal points to keep in representing data
            (default = 4 digits; None will keep all digits)

    Returns:
        None