code: def convert_time_delta(td: datetime.timedelta | float | int) -> str:
      """
      It converts a time delta in nanoseconds to a string
  
      :param td: Timedelta or the time difference in nanoseconds
      :rtype: str
      """
      if not isinstance(td, datetime.timedelta):
          td = datetime.timedelta(seconds=td // 1e9)
  
      time_delta = ""
      if td.days // 7 > 0:
          time_delta = str(td.days // 7) + "w"
  
      if td.days % 7 > 0:
          time_delta += " " + str(td.days % 7) + "d"
  
      if td.seconds // 3600 > 0:
          time_delta += " " + str(td.seconds // 3600) + "h"
  
      if (td.seconds // 60) % 60 > 0:
          time_delta += " " + str((td.seconds // 60) % 60) + "m"
  
      if td.seconds % 60 > 0:
          time_delta += " " + str(td.seconds % 60) + "s"
  
      if time_delta == "" and td.microseconds > 0:
          if td.microseconds // 1000 > 0:
              time_delta += f" {td.microseconds // 1000} ms"
          else:
              time_delta += f" {td.microseconds} μs"
  
      return time_delta.strip()
  
imports: from __future__ import annotations
  import datetime
  import json
  import logging
  import math
  import warnings
  from collections import defaultdict
  import numpy
  import pandas
  import plotly.express
  import plotly.graph_objects
  from popmon.resources import templates_env
label_desc: Use image node_id 2 for calling a global function with example usage: convert_time_delta(td) and returns: time_delta