<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _refresh_layout(self):
 """ This queues and batches model changes so that the layout is only refreshed after the `_pending_timeout` expires. This prevents the UI from refreshing when inserting or removing a large number of items until the operation is complete. """

        self._pending_view_refreshes -= 1
        if self._pending_view_refreshes == 0:
            try:
                self.model.layoutChanged.emit()
                self.on_layout_refreshed()
            except RuntimeError:
                # View can be destroyed before we get here
                return
            self._refresh_sizes()