def METHOD_NAME(self, size, trunc=False):
    """Resize already allocated shared memory chunk. If you want to resize the underlying
    shared memory chunk pass trunc=True, if the memory chunk has already been resized
    via another SharedMem instance (possibly in another process), pass new size and
    trunc=False to simply adjust mmaping of the memory into the current process address space.
    """
    if 'buf' in self.__dict__:
        del self.__dict__['buf']
    self.shm.METHOD_NAME(size, trunc)
    self.capacity = size