code: def send(command, data):
      """Send command to Training Service.
      command: CommandType object.
      data: string payload.
      """
      global _lock
      try:
          _lock.acquire()
          data = data.encode("utf8")
          msg = b"%b%014d%b" % (command.value.encode(), len(data), data)
          _logger.debug("Sending command, data: [%s]", msg)
          _out_file.write(msg)
          _out_file.flush()
      finally:
          _lock.release()
  
file_path: nni/nni/runtime/tuner_command_channel/legacy.py
imports: import logging
  import os
  import threading
  from .command_type import CommandType
label_desc: Use image node_id 4 for calling a global function with example usage: send(command, data) without return types