code: def to_ply(pos, label, file):
      assert len(label.shape) == 1
      assert pos.shape[0] == label.shape[0]
      pos = np.asarray(pos)
      colors = OBJECT_COLOR[np.asarray(label)]
      ply_array = np.ones(
          pos.shape[0],
          dtype=[
              ("x", "f4"),
              ("y", "f4"),
              ("z", "f4"),
              ("red", "u1"),
              ("green", "u1"),
              ("blue", "u1"),
          ],
      )
      ply_array["x"] = pos[:, 0]
      ply_array["y"] = pos[:, 1]
      ply_array["z"] = pos[:, 2]
      ply_array["red"] = colors[:, 0]
      ply_array["green"] = colors[:, 1]
      ply_array["blue"] = colors[:, 2]
      el = PlyElement.describe(ply_array, "S3DIS")
      PlyData([el], byte_order=">").write(file)
  
imports: import os
  import os.path
  from itertools import repeat, product
  import numpy
  import h5py
  import torch
  import random
  import glob
  from plyfile import PlyData, PlyElement
  from torch_geometric.data import InMemoryDataset, Data, extract_zip, Dataset
  from torch_geometric.data.dataset import files_exist
  from torch_geometric.data import DataLoader
  from torch_geometric.datasets import S3DIS
  import torch_geometric.transforms
  import logging
  from sklearn.neighbors import NearestNeighbors, KDTree
  from tqdm.auto import tqdm
  import csv
  import pandas
  import pickle
  import gdown
  import shutil
  from torch_points3d.datasets.samplers import BalancedRandomSampler
  import torch_points3d.core.data_transform
  from torch_points3d.datasets.base_dataset import BaseDataset
label_desc: Use image node_id 3 for calling a global function with example usage: to_ply(pos, label, file) without return types