class_docstr: Keeps ssh connections to share. Serves singleton representation
  per connection.
  
  A custom identity file can be specified via `datalad.ssh.identityfile`.
  Callers are responsible for reloading `datalad.cfg` if they have changed
  this value since loading datalad.
class_docstr_tok: ["Keeps","ssh","connections","to","share",".","Serves","singleton","representation","per","connection",".","A","custom","identity","file","can","be","specified","via","`","datalad.ssh.identityfile","`",".","Callers","are","responsible","for","reloading","`","datalad.cfg","`","if","they","have","changed","this","value","since","loading","datalad","."]
docstr: Assures that manager is initialized - knows socket_dir, previous connections
          
code: def ensure_initialized(self):
      """Assures that manager is initialized - knows socket_dir, previous connections"""
      if self._socket_dir is not None:
          return
      from datalad import cfg
  
      self._socket_dir = Path(cfg.obtain("datalad.locations.sockets"))
      self._socket_dir.mkdir(exist_ok=True, parents=True)
      try:
          os.chmod(str(self._socket_dir), 0o700)
      except OSError as exc:
          lgr.warning(
              "Failed to (re)set permissions on the %s. "
              "Most likely future communications would be impaired or fail. "
              "Original exception: %s",
              self._socket_dir,
              CapturedException(exc),
          )
  
      try:
          self._prev_connections = [
              p for p in self.socket_dir.iterdir() if not p.is_dir()
          ]
      except OSError as exc:
          self._prev_connections = []
          lgr.warning(
              "Failed to list %s for existing sockets. "
              "Most likely future communications would be impaired or fail. "
              "Original exception: %s",
              self._socket_dir,
              CapturedException(exc),
          )
  
      lgr.log(
          5,
          "Found %d previous connections",
          len(self._prev_connections),
      )
  
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 3 for calling the MultiplexSSHManager obj's underlying member method code with example usage: obj.ensure_initialized() without return types