code: def _run_duration(run):
      started = run.get("started")
      if run.status == "running":
          return util.format_duration(started)
      stopped = run.get("stopped")
      if stopped:
          return util.format_duration(started, stopped)
      return ""
  
imports: import json
  import logging
  import os
  import re
  import socket
  import sys
  import guild
  import guild.run
  from guild import batch_util
  from guild import cli
  from guild import click_util
  from guild import config
  from guild import index
  from guild import run_util
  from guild import util
  from guild import var
  from guild import view
  from .None import compare_impl
  from .None import runs_impl
label_desc: Use image node_id 6 for calling a global function with example usage: _run_duration(run) and returns: str, util, util