code: def encode_spm(
      model,
      direction,
      prefix="",
      splits=["train", "test", "valid"],
      pairs_per_shard=None,
  ):
      src, tgt = direction.split("-")
  
      for split in splits:
          src_raw, tgt_raw = (
              f"{RAW_DIR}/{split}{prefix}.{direction}.{src}",
              f"{RAW_DIR}/{split}{prefix}.{direction}.{tgt}",
          )
          if os.path.exists(src_raw) and os.path.exists(tgt_raw):
              cmd = f"""python {SPM_ENCODE} \
              --model {model}\
              --output_format=piece \
              --inputs {src_raw} {tgt_raw}  \
              --outputs {BPE_DIR}/{direction}{prefix}/{split}.bpe.{src} {BPE_DIR}/{direction}{prefix}/{split}.bpe.{tgt} """
              print(cmd)
              call(cmd)
  
file_path: fairseq/examples/multilingual/data_scripts/binarize.py
imports: import shutil
  import os, sys
  from subprocess import check_call, check_output
  import glob
  import argparse
  import shutil
  import pathlib
  import itertools
label_desc: Use image node_id 4 for calling a global function with example usage: encode_spm(model, direction, prefix, splits, pairs_per_shard) without return types