class_docstr: Representation of a (shared) ssh connection.
      
class_docstr_tok: ["Representation","of","a","(","shared",")","ssh","connection","."]
docstr: Opens the connection.
  
  In other words: Creates the SSH ControlMaster to be used by this
  connection, if it is not there already.
  
  Returns
  -------
  bool
    True when SSH reports success opening the connection, False when
    a ControlMaster for an open connection already exists.
  
  Raises
  ------
  ConnectionOpenFailedError
    When starting the SSH ControlMaster process failed.
code: def open(self):
      """Opens the connection.
  
      In other words: Creates the SSH ControlMaster to be used by this
      connection, if it is not there already.
  
      Returns
      -------
      bool
        True when SSH reports success opening the connection, False when
        a ControlMaster for an open connection already exists.
  
      Raises
      ------
      ConnectionOpenFailedError
        When starting the SSH ControlMaster process failed.
      """
      # the socket should vanish almost instantly when the connection closes
      # sending explicit 'check' commands to the control master is expensive
      # (needs tempfile to shield stdin, Runner overhead, etc...)
      # as we do not use any advanced features (forwarding, stop[ing the
      # master without exiting) it should be relatively safe to just perform
      # the much cheaper check of an existing control path
      if self.ctrl_path.exists():
          return False
  
      # create ssh control master command
      cmd = self._assemble_multiplex_ssh_cmd(self._ssh_open_args)
  
      # start control master:
      lgr.debug("Opening %s by calling %s", self, cmd)
      # The following call is exempt from bandit's security checks because
      # we/the user control the content of 'cmd'.
      proc = Popen(cmd)  # nosec
      stdout, stderr = proc.communicate(
          input="\n"
      )  # why the f.. this is necessary?
  
      # wait till the command exits, connection is conclusively
      # open or not at this point
      exit_code = proc.wait()
  
      if exit_code != 0:
          raise ConnectionOpenFailedError(
              cmd,
              "Failed to open SSH connection (could not start ControlMaster process)",
              exit_code,
              stdout,
              stderr,
          )
      self._opened_by_us = True
      return True
  
imports: import fasteners
  import os
  import logging
  from socket import gethostname
  from hashlib import md5
  from subprocess import Popen
  import tempfile
  import threading
  from datalad.utils import quote_cmdlinearg
  from datalad.support.exceptions import CapturedException, CommandError, ConnectionOpenFailedError
  from datalad.support.external_versions import external_versions
  from datalad.utils import auto_repr, Path, ensure_list, on_windows
  from datalad.cmd import NoCapture, StdOutErrCapture, WitlessRunner
  from ..None import cfg
label_desc: Use image node_id 5 for calling the MultiplexSSHConnection obj's underlying member method code with example usage: obj.open() and returns: True, False