def METHOD_NAME(data, output_dir, validation_ratio, testing_ratio):
    print("Preprocessing data to NeMo_SFT jsonl format...")
    output_path_tra = os.path.join(output_dir, "training.jsonl")
    output_path_val = os.path.join(output_dir, "validation.jsonl")
    output_path_tst = os.path.join(output_dir, "testing.jsonl")
    data_ct = len(data)
    val_threshold = int(data_ct * validation_ratio)
    test_threshold = int(data_ct * testing_ratio)
    with open(output_path_val, "w") as g, open(output_path_tst, "w") as h, open(output_path_tra, "w") as i:
        for index, item in data.iterrows():
            context = item["context"].strip()
            if context != "":
                # Randomize context and instruction order.
                context_first = np.random.randint(0, 2) == 0
                if context_first:
                    instruction = item["instruction"].strip()
                    assert instruction != ""
                    input = f"{context}\n\n{instruction}"
                    output = item["response"]
                else:
                    instruction = item["instruction"].strip()
                    assert instruction != ""
                    input = f"{instruction}\n\n{context}"
                    output = item["response"]
            else:
                input = item["instruction"]
                output = item["response"]
            # write to jsonl file according to index
            if index < val_threshold:
                h.write(json.dumps({"input": input, "output": output}) + "\n")
            elif index < val_threshold + test_threshold:
                g.write(json.dumps({"input": input, "output": output}) + "\n")
            else:
                i.write(json.dumps({"input": input, "output": output}) + "\n")
    print(f"{index+1} out of {data_ct} Data was successfully preprocessed and saved.")