<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update(self, sums):
 """ Update self.et with the sums as returned by VersionsX.sums_get @param sums: {'version': {'file1':'hash1'}} """

        for version in sums:
            hashes = sums[version]
            for filename in hashes:
                hsh = hashes[filename]
                file_xpath = './files/*[@url="%s"]' % filename
                try:
                    file_add = self.root.findall(file_xpath)[0]
                except IndexError:
                    raise ValueError("Attempted to update element '%s' which doesn't exist" % filename)

                # Do not add duplicate, equal hashes.
                if not self.version_exists(file_add, version, hsh):
                    new_ver = ET.SubElement(file_add, 'version')
                    new_ver.attrib = {
                            'md5': hsh,
                            'nb': version
                    }