<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def shape(self, pixelbuffer=0):
 """ Return a tuple of tile height and width. - pixelbuffer: tile buffer in pixels """

        # apply pixelbuffers
        height = self._base_shape.height + 2 * pixelbuffer
        width = self._base_shape.width + 2 * pixelbuffer
        if pixelbuffer and self.tp.grid.is_global:
            # on first and last row, remove pixelbuffer on top or bottom
            matrix_height = self.tile_pyramid.matrix_height(self.zoom)
            if matrix_height == 1:
                height = self._base_shape.height
            elif self.row in [0, matrix_height - 1]:
                height = self._base_shape.height + pixelbuffer
        return Shape(height=height, width=width)