'Replaces the memory object `old` with a new memory object containing `new_content`.
:param old:         A SimMemoryObject (i.e., one from :func:`memory_objects_for_hash()` or :func:`
memory_objects_for_name()`).
:param new_content: The content (claripy expression) for the new memory object.
:returns: the new memory object'

def replace_memory_object(self, old, new_content):

    if (old.object.size() != new_content.size()):
        raise SimMemoryError('memory    objects    can    only    be    replaced    by    the    same    length    content')
    new = SimMemoryObject(new_content, old.base)
    for p in self._containing_pages_mo(old):
        self._get_page((p / self._page_size), write=True).replace_mo(self.state, old, new)
    if isinstance(new.object, claripy.ast.BV):
        for b in range(old.base, (old.base + old.length)):
            self._update_mappings(b, new.object)
    return new
