code: def format_time(time, unit="ms", inf_subs="-"):
      r"""
      Transform time in ns to time in unit.
      """
      if time == float("inf"):
          return inf_subs
      else:
          result = float(time)
          if unit == "s":
              result /= 1e9
          elif unit == "ms":
              result /= 1e6
          elif unit == "us":
              result /= 1e3
          return round(result, 2)
  
imports: import collections
  import os
  import sys
label_desc: Use image node_id 10 for calling a global function with example usage: format_time(time, unit, inf_subs) and returns: inf_subs, round