docs: def load_ssh_key(key_id, skip_priv_key=False):
      """
      Load a local ssh private key (in PEM format). PEM format is the OpenSSH
      default format for private keys.
  
      See similar code in imgapi.js#loadSSHKey.
  
      @param key_id {str} An ssh public key fingerprint or ssh private key path.
      @param skip_priv_key {boolean} Optional. Default false. If true, then this
          will skip loading the private key file and `priv_key` will be `None`
          in the retval.
      @returns {dict} with these keys:
          - pub_key_path
          - fingerprint
          - priv_key_path
          - priv_key
          - algorithm
      """
      priv_key = None
  
      # If `key_id` is already a private key path, then easy.
      if not FINGERPRINT_RE.match(key_id):
          if not skip_priv_key:
              f = io.open(key_id, 'rb')
              try:
                  priv_key = f.read()
              finally:
                  f.close()
          pub_key_path = key_id + '.pub'
          f = io.open(pub_key_path, 'r')
          try:
              pub_key = f.read()
          finally:
              f.close()
          fingerprint = fingerprint_from_ssh_pub_key(pub_key)
  
          # XXX: pubkey should NOT be in PEM format.
          try:
              algo = ALGO_FROM_SSH_KEY_TYPE[pub_key.split()[0]]
          except KeyError:
              raise MantaError("Unsupported key type for: {}".format(key_id))
  
          return dict(
              pub_key_path=pub_key_path,
              fingerprint=fingerprint,
              priv_key_path=key_id,
              priv_key=priv_key,
              algorithm=algo)
  
      # Else, look at all pub/priv keys in "~/.ssh" for a matching fingerprint.
      fingerprint = key_id
  
      pub_key_glob = expanduser('~/.ssh/*.pub')
      pub_key = None
      for pub_key_path in glob(pub_key_glob):
          try:
              f = io.open(pub_key_path, 'r')
          except IOError:
              # This can happen if the .pub file is a broken symlink.
              log.debug("could not open '%s', skip it", pub_key_path)
              continue
          try:
              pub_key = f.read()
          finally:
              f.close()
  
          # The MD5 fingerprint functions return the hexdigest without the hash
          # algorithm prefix ("MD5:"), and the SHA256 functions return the
          # fingerprint with the prefix ("SHA256:").  Ideally we'd want to
          # normalize these, but more importantly we don't want to break backwards
          # compatibility for either the SHA or MD5 users.
          md5_fp = fingerprint_from_ssh_pub_key(pub_key)
          sha256_fp = sha256_fingerprint_from_ssh_pub_key(pub_key)
          if (sha256_fp == fingerprint or
              md5_fp == fingerprint or
              "MD5:" + md5_fp == fingerprint):
  
              # if the user has given us sha256 fingerprint, canonicalize
              # it to the md5 fingerprint
              fingerprint = md5_fp
              break
      else:
          raise MantaError(
              "no '~/.ssh/*.pub' key found with fingerprint '%s'"
              % fingerprint)
  
      # XXX: pubkey should NOT be in PEM format.
      try:
          algo = ALGO_FROM_SSH_KEY_TYPE[pub_key.split()[0]]
      except KeyError:
          raise MantaError("Unsupported key type for: {}".format(key_id))
  
      priv_key_path = os.path.splitext(pub_key_path)[0]
      if not skip_priv_key:
          f = io.open(priv_key_path, 'rb')
          try:
              priv_key = f.read()
          finally:
              f.close()
      return dict(
          pub_key_path=pub_key_path,
          fingerprint=fingerprint,
          priv_key_path=priv_key_path,
          priv_key=priv_key,
          algorithm=algo)