<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _finalize_grid(self, *axlabels):
 """Finalize the annotations and layout."""

        if not self._finalized:
            self.set_axis_labels(*axlabels)
            self.set_titles()
            self.fig.tight_layout()

            for ax, namedict in zip(self.axes.flat, self.name_dicts.flat):
                if namedict is None:
                    ax.set_visible(False)

            self._finalized = True