code: def _send_internal(self, msg, retries=3):
      if self._process is None:
          return False
      try:
          if msg.msg_type == MessageTypes.BEST_EFFORT:
              # If we have a mustsend to send, we need to send it first prior to
              # sending a best-effort message
              if self._send_mustsend_remaining_tries == -1:
                  # We could not send the "mustsend" so we don't try to send this out;
                  # restart sidecar so use the PipeUnavailableError caught below
                  raise PipeUnavailableError()
              elif self._send_mustsend_remaining_tries > 0:
                  self._send_mustsend()
              if self._send_mustsend_remaining_tries == 0:
                  self._emit_msg(msg)
                  self._prev_message_error = False
                  return True
          else:
              self._emit_msg(msg)
              self._prev_message_error = False
              return True
          return False
      except MsgTimeoutError:
          # drop message, do not retry on timeout
          self._logger("Unable to send message due to timeout")
          self._prev_message_error = True
      except Exception as ex:
          if isinstance(ex, (PipeUnavailableError, BrokenPipeError)):
              self._logger(
                  "Restarting sidecar due to broken/unavailable pipe"
              )
              self.start()
              if self._cached_mustsend is not None:
                  self._send_mustsend_remaining_tries = (
                      MUST_SEND_RETRY_TIMES
                  )
                  # We don't send the "must send" here, letting it send "lazily" on the
                  # next message. The reason for this is to simplify the interactions
                  # with the retry logic.
          else:
              self._prev_message_error = True
          if retries > 0:
              self._logger(
                  "Retrying msg send to sidecar (due to %s)" % repr(ex)
              )
              return self._send_internal(msg, retries - 1)
          else:
              self._logger(
                  "Error sending log message (exhausted retries): %s"
                  % repr(ex)
              )
      return False
  
imports: from __future__ import print_function
  import subprocess
  import fcntl
  import select
  import os
  import sys
  import platform
  from fcntl import F_SETFL
  from os import O_NONBLOCK
  from .sidecar_messages import Message, MessageTypes
  from ..debug import debug
  from metaflow.tracing import inject_tracing_vars
label_desc: Use image node_id 6 for calling the SidecarSubProcess obj's underlying member method code with example usage: obj._send_internal(msg, retries) and returns: False, False, False, True, True, self