docs: def update_metadata(self, key, value):
          """Set *key* in the metadata to *value*.
  
          Returns the previous value of *key*, or None if the key was
          not previously set.
          """
          old_value = self.contents['metadata'].get(key)
          self.contents['metadata'][key] = value
          self._log('Updated metadata: %s=%s' % (key, value))
          return old_value