code: def convert_data(lines, label_name="labels"):
      modified_lines = []
      for line in lines:
          line = json.loads(line)
          if "labels" in line:
              line[label_name] = line.pop("labels")
          else:
              line[label_name] = []
              continue
  
          tmp_ents = []
          for e in line[label_name]:
              tmp_ents.append((e[0], e[1], e[2]))
              # tmp_ents.append({"start": e[0], "end": e[1], "label": e[2]})
  
              line[label_name] = tmp_ents
  
          if len(line["text"]) > 3:
              modified_lines.append(
                  json.dumps(
                      {
                          label_name: line[label_name],
                          "text": line["text"],
                      }
                  )
              )
  
      return modified_lines
  
imports: import pandas
  import json
  import logging
  import os
  import torch
  from torch import nn
  from dataclasses import dataclass
  from enum import Enum
  from typing import List, Optional, Union
  from pathlib import Path
  import pickle
  from filelock import FileLock
  import re
  import shutil
  from sklearn.model_selection import train_test_split
  from torch.utils.data import Dataset, TensorDataset, DataLoader, RandomSampler, SequentialSampler
  from torch.utils.data.distributed import DistributedSampler
  from transformers import PreTrainedTokenizer, AutoTokenizer
label_desc: Use image node_id 4 for calling a global function with example usage: convert_data(lines, label_name) and returns: modified_lines