code: def bandwidth_client(addr, packet_size, duration):
      sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
      sock.bind(("127.0.0.1", 0))
      local_addr = sock.getsockname()
      _time = time.time
      _sleep = time.sleep
  
      def _send_chunk(msg):
          _sendto(
              sock,
              ("%r#%s\n" % (local_addr, msg)).rjust(packet_size),
              addr,
          )
  
      # We give the parent some time to be ready.
      _sleep(1.0)
      try:
          start_time = _time()
          end_time = start_time + duration * 2.0
          i = 0
          while _time() < end_time:
              _send_chunk(str(i))
              s = _recv(sock, packet_size)
              assert len(s) == packet_size
              i += 1
          _send_chunk(BW_END)
      finally:
          sock.close()
  
imports: from __future__ import division
  from __future__ import print_function
  import time
  import os
  import sys
  import itertools
  import threading
  import subprocess
  import socket
  from optparse import OptionParser, SUPPRESS_HELP
  import platform
label_desc: Use image node_id 15 for calling a global function with example usage: bandwidth_client(addr, packet_size, duration) without return types