'Merge the contents of "values" with the current contents of the
database.'

def merge_dictionary(self, values):

    if (not values):
        return
    lock_fd = self._aquire_lock()
    try:
        contents = self.get_dictionary()
        contents.update(values)
        (fd, fname) = tempfile.mkstemp(prefix=os.path.basename(self.path), dir=os.path.dirname(self.path))
        write_file = os.fdopen(fd, 'wb')
        try:
            try:
                cPickle.dump(contents, write_file, protocol=cPickle.HIGHEST_PROTOCOL)
            finally:
                write_file.close()
            os.rename(fname, self.path)
        except Exception:
            os.unlink(fname)
            raise
    finally:
        os.close(lock_fd)
