'not using the paramiko save_ssh_host_keys function as we want to add new SSH keys at the bottom so folks
don\'t complain about it :)'

def _save_ssh_host_keys(self, filename):

    if (not self._any_keys_added()):
        return False
    path = os.path.expanduser('~/.ssh')
    makedirs_safe(path)
    f = open(filename, 'w')
    for (hostname, keys) in iteritems(self.ssh._host_keys):
        for (keytype, key) in iteritems(keys):
            added_this_time = getattr(key, '_added_by_ansible_this_time', False)
            if (not added_this_time):
                f.write(('%s    %s    %s\n' % (hostname, keytype, key.get_base64())))
    for (hostname, keys) in iteritems(self.ssh._host_keys):
        for (keytype, key) in iteritems(keys):
            added_this_time = getattr(key, '_added_by_ansible_this_time', False)
            if added_this_time:
                f.write(('%s    %s    %s\n' % (hostname, keytype, key.get_base64())))
    f.close()
