code: def _load_private_key(self, private_key, passphrase=None):
          
          key = None
          last_exception = None
          for pkey_class in (RSAKey, DSSKey):
              try:
                  key = pkey_class.from_private_key(StringIO(private_key),
                      passphrase)
              except PasswordRequiredException as e:
                  # The key file is encrypted and no passphrase was provided.
                  # There's no point to continue trying
                  raise
              except SSHException as e:
                  last_exception = e
                  continue
              else:
                  break
          if key is None and last_exception:
              raise last_exception
          return key
docs: Load a SSH private key (DSA or RSA) from a string
  
          The private key may be encrypted. In that case, a passphrase
          must be supplied.