code: def kubricify(asset, source_dir, target_dir):
      source_dir = pathlib.Path(source_dir)
      target_dir = pathlib.Path(target_dir)
      target_dir.mkdir(parents=True, exist_ok=True)
      name = asset["name"]
  
      # --- source paths
      asset_raw_path = source_dir / (name + ".zip")
      asset_tmp_dir = source_dir / name
  
      texture_source_path = (
          asset_tmp_dir / "materials" / "textures" / "texture.png"
      )
      obj_source_path = asset_tmp_dir / "meshes" / "model.obj"
      mat_source_path = asset_tmp_dir / "meshes" / "model.mtl"
  
      # --- target paths
      target_asset_dir = target_dir / name
      vis_path = target_asset_dir / "visual_geometry.obj"
      mat_path = target_asset_dir / "visual_geometry.mtl"
      coll_path = target_asset_dir / "collision_geometry.obj"
      urdf_path = target_asset_dir / "object.urdf"
      json_path = target_asset_dir / "data.json"
      tex_path = target_asset_dir / "texture.png"
      tar_path = target_dir / (name + ".tar.gz")
  
      if tar_path.exists():
          with tarfile.open(tar_path, "r:gz") as tar:
              tar.extract("data.json", target_asset_dir)
          asset_entry = file_io.read_json(json_path)
          if asset_entry and "id" in asset_entry:
              shutil.rmtree(target_asset_dir)
              return asset_entry["id"], asset_entry
  
      # extract source to asset_tmp_dir
      with zipfile.ZipFile(asset_raw_path, "r") as zip_ref:
          zip_ref.extractall(asset_tmp_dir)
  
      # clear target path
      if target_asset_dir.exists():
          shutil.rmtree(target_asset_dir)
      target_asset_dir.mkdir(parents=True, exist_ok=True)
  
      # --- convert
      # copy the texture to a place that trimesh will find
      shutil.copy(
          texture_source_path, asset_tmp_dir / "meshes" / "texture.png"
      )
  
      # import mesh into trimesh
      tmesh = tm.load_mesh(obj_source_path, file_type="obj")
      # center it around center of mass
      tmesh.apply_translation(-tmesh.center_mass)
      # export to obj again
      obj_content = tri_obj.export_obj(tmesh)
      obj_content = re.sub(
          "mtllib material_0.mtl\nusemtl material_0\n",
          f"mtllib {mat_path.name}\nusemtl material_0\n",
          obj_content,
      )
      with open(vis_path, "w") as f:
          f.write(obj_content)
  
      shutil.move(mat_source_path, mat_path)
      shutil.move(texture_source_path, tex_path)
  
      with redirect_io.RedirectStream(stream=sys.stdout):
          pb.vhacd(
              str(vis_path),
              str(coll_path),
              str(asset_tmp_dir / "pybullet.log"),
          )
  
      properties = get_object_properties(tmesh)
  
      with open(urdf_path, "w") as f:
          f.write(URDF_TEMPLATE.format(id=asset["name"], **properties))
  
      asset_entry = {
          "id": asset["name"],
          "asset_type": "FileBasedObject",
          "kwargs": {
              "bounds": properties["bounds"],
              "mass": properties["mass"],
              "render_filename": "{asset_dir}/" + vis_path.name,
              "simulation_filename": "{asset_dir}/" + urdf_path.name,
          },
          "license": "CC BY-SA 4.0",
          "metadata": {
              "nr_faces": properties["nr_faces"],
              "nr_vertices": properties["nr_vertices"],
              "surface_area": properties["surface_area"],
              "volume": properties["volume"],
              "category": asset["category"],
              "description": asset["description"],
          },
      }
  
      with open(json_path, "w") as f:
          json.dump(asset_entry, f, indent=4, sort_keys=True)
  
      with tarfile.open(tar_path, "w:gz") as tar:
          for p in target_asset_dir.glob("*"):
              tar.add(p, arcname=p.name)
  
      shutil.rmtree(asset_tmp_dir)
      shutil.rmtree(target_asset_dir)
  
      return name, asset_entry
  
imports: import argparse
  import functools
  import itertools
  import json
  import logging
  import multiprocessing
  import pathlib
  import re
  import shutil
  import ssl
  import sys
  import tarfile
  import urllib
  import urllib.request
  import urllib.error
  import zipfile
  import pybullet
  import tqdm
  import trimesh
  import trimesh.exchange.obj
  from kubric import file_io
  from kubric import redirect_io
  from kubric.kubric_typing import PathLike
label_desc: Use image node_id 7 for calling a global function with example usage: kubricify(asset, source_dir, target_dir) and returns: name,  asset_entry, asset_entry,  asset_entry