code: def parse_code(code_str, dictionary, append_eos):
      code, duration = torch.unique_consecutive(
          torch.ShortTensor(list(map(int, code_str.split()))),
          return_counts=True,
      )
      code = " ".join(map(str, code.tolist()))
      code = dictionary.encode_line(code, append_eos).short()
  
      if append_eos:
          duration = torch.cat(
              (duration, duration.new_zeros((1,))), dim=0
          )  # eos
      duration = duration.short()
      return code, duration
  
imports: import json
  import logging
  import os
  import random
  from pathlib import Path
  import numpy
  import torch
  import torch.utils.data
  from .None import data_utils
  from fairseq.data.fairseq_dataset import FairseqDataset
label_desc: Use image node_id 5 for calling a global function with example usage: parse_code(code_str, dictionary, append_eos) and returns: code,  duration