code: def _command(
      self,
      flow_name,
      run_id,
      step_name,
      task_id,
      attempt,
      code_package_url,
      step_cmds,
  ):
      mflog_expr = export_mflog_env_vars(
          flow_name=flow_name,
          run_id=run_id,
          step_name=step_name,
          task_id=task_id,
          retry_count=attempt,
          datastore_type=self._datastore.TYPE,
          stdout_path=STDOUT_PATH,
          stderr_path=STDERR_PATH,
      )
      init_cmds = self._environment.get_package_commands(
          code_package_url, self._datastore.TYPE
      )
      init_expr = " && ".join(init_cmds)
      step_expr = bash_capture_logs(
          " && ".join(
              self._environment.bootstrap_commands(
                  step_name, self._datastore.TYPE
              )
              + step_cmds
          )
      )
  
      # Construct an entry point that
      # 1) initializes the mflog environment (mflog_expr)
      # 2) bootstraps a metaflow environment (init_expr)
      # 3) executes a task (step_expr)
  
      # The `true` command is to make sure that the generated command
      # plays well with docker containers which have entrypoint set as
      # eval $@
      cmd_str = "true && mkdir -p %s && %s && %s && %s; " % (
          LOGS_DIR,
          mflog_expr,
          init_expr,
          step_expr,
      )
      # After the task has finished, we save its exit code (fail/success)
      # and persist the final logs. The whole entrypoint should exit
      # with the exit code (c) of the task.
      #
      # Note that if step_expr OOMs, this tail expression is never executed.
      # We lose the last logs in this scenario.
      #
      # TODO: Capture hard exit logs in Kubernetes.
      cmd_str += "c=$?; %s; exit $c" % BASH_SAVE_LOGS
      # For supporting sandboxes, ensure that a custom script is executed before
      # anything else is executed. The script is passed in as an env var.
      cmd_str = (
          '${METAFLOW_INIT_SCRIPT:+eval \\"${METAFLOW_INIT_SCRIPT}\\"} && %s'
          % cmd_str
      )
      return shlex.split('bash -c "%s"' % cmd_str)
  
imports: import json
  import math
  import os
  import re
  import shlex
  import time
  from typing import Dict, List, Optional
  import uuid
  from uuid import uuid4
  from metaflow import current, util
  from metaflow.exception import MetaflowException
  from metaflow.metaflow_config import ARGO_EVENTS_EVENT, ARGO_EVENTS_EVENT_BUS, ARGO_EVENTS_EVENT_SOURCE, ARGO_EVENTS_SERVICE_ACCOUNT, ARGO_EVENTS_INTERNAL_WEBHOOK_URL, AWS_SECRETS_MANAGER_DEFAULT_REGION, ARGO_EVENTS_WEBHOOK_AUTH, AZURE_STORAGE_BLOB_SERVICE_ENDPOINT, CARD_AZUREROOT, CARD_GSROOT, CARD_S3ROOT, DATASTORE_SYSROOT_AZURE, DATASTORE_SYSROOT_GS, DATASTORE_SYSROOT_S3, DATATOOLS_S3ROOT, DEFAULT_AWS_CLIENT_PROVIDER, DEFAULT_METADATA, DEFAULT_SECRETS_BACKEND_TYPE, KUBERNETES_FETCH_EC2_METADATA, KUBERNETES_LABELS, KUBERNETES_SANDBOX_INIT_SCRIPT, S3_ENDPOINT_URL, SERVICE_HEADERS, SERVICE_INTERNAL_URL, S3_SERVER_SIDE_ENCRYPTION, OTEL_ENDPOINT
  from metaflow.metaflow_config_funcs import config_values
  from metaflow.mflog import BASH_SAVE_LOGS, bash_capture_logs, export_mflog_env_vars, get_log_tailer, tail_logs
  from .kubernetes_client import KubernetesClient
label_desc: Use image node_id 2 for calling the Kubernetes obj's underlying member method code with example usage: obj._command(flow_name, run_id, step_name, task_id, attempt, code_package_url, step_cmds) and returns: shlex