code: def _GenerateSshKey(self, key_type, key_dest):
      
      # Create a temporary file to save the created RSA keys.
      with tempfile.NamedTemporaryFile(prefix=key_type, delete=True) as temp:
        temp_key = temp.name
  
      command = ['ssh-keygen', '-t', key_type, '-f', temp_key, '-N', '', '-q']
      try:
        self.logger.info('Generating SSH key %s.', key_dest)
        subprocess.check_call(command)
      except subprocess.CalledProcessError:
        self.logger.warning('Could not create SSH key %s.', key_dest)
        return
  
      shutil.move(temp_key, key_dest)
      shutil.move('%s.pub' % temp_key, '%s.pub' % key_dest)
  
      file_utils.SetPermissions(key_dest, mode=0o600)
      file_utils.SetPermissions('%s.pub' % key_dest, mode=0o644)
docs: Generate a new SSH key.
  
      Args:
        key_type: string, the type of the SSH key.
        key_dest: string, a file location to store the SSH key.