'@return: self'

def update(self, otherdict):

    assert self._assert_invariants()
    if (len(otherdict) >= (self.m - 2)):
        self.clear()
        assert self._assert_invariants()
        i = otherdict.iteritems()
        try:
            while (len(self.d) < self.m):
                (k, v) = i.next()
                assert self._assert_invariants()
                self[k] = v
                assert self._assert_invariants()
            return self
        except StopIteration:
            _assert(False, 'Internal    error    --    this    should    never    have    happened    since    the    while    loop    should    have    terminated    first.')
            return self
    for (k, v) in otherdict.iteritems():
        assert self._assert_invariants()
        self[k] = v
        assert self._assert_invariants()
