code: def gen_cmd_exec_failure_msg(cmd, return_code, tail_output_deque):
      cmd_str = " ".join(cmd)
      tail_output = "".join(tail_output_deque)
      return (
          f"Command {cmd_str} failed with return code {return_code}, tail output are "
          f"included below.\n{tail_output}\n"
      )
  
imports: import subprocess
  import os
  import sys
  import random
  import threading
  import collections
  import logging
  import time
label_desc: Use image node_id 2 for calling a global function with example usage: gen_cmd_exec_failure_msg(cmd, return_code, tail_output_deque) and returns: str, cmd_str, str, return_code, str, tail_output, str