def METHOD_NAME(ark_filename, out_prefix, compression_type=None):
    """Converts ARK dataset to TFRecords."""
    record_writer = tf.io.TFRecordWriter(
        out_prefix + ".records", options=compression_type
    )
    count = 0
    with open(ark_filename, encoding="utf-8") as ark_file:
        while True:
            ark_idx, vector = consume_next_vector(ark_file)
            if not ark_idx:
                break
            write_sequence_record(vector, record_writer)
            count += 1
    record_writer.close()
    print("Saved {} records.".format(count))