<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def extract_surface(self, pass_pointid=True, pass_cellid=True, inplace=False):
 """ Extract surface mesh of the grid Parameters pass_pointid : bool, optional Adds a point scalar "vtkOriginalPointIds" that idenfities which original points these surface points correspond to pass_cellid : bool, optional Adds a cell scalar "vtkOriginalPointIds" that idenfities which original cells these surface cells correspond to inplace : bool, optional Return new mesh or overwrite input. Returns ------- extsurf : vtki.PolyData Surface mesh of the grid """

        surf_filter = vtk.vtkDataSetSurfaceFilter()
        surf_filter.SetInputData(self)
        if pass_pointid:
            surf_filter.PassThroughCellIdsOn()
        if pass_cellid:
            surf_filter.PassThroughPointIdsOn()
        surf_filter.Update()

        mesh = _get_output(surf_filter)
        if inplace:
            self.overwrite(mesh)
        else:
            return mesh