<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def remove_polygons(self, test):
 """ Remove polygons from this cell. The function or callable ``test`` is called for each polygon in the cell. If its return value evaluates to ``True``, the corresponding polygon is removed from the cell. Parameters test : callable Test function to query whether a polygon should be removed. The function is called with arguments: ``(points, layer, datatype)`` Returns ------- out : ``Cell`` This cell. Examples -------- Remove polygons in layer 1: Remove polygons with negative x coordinates: """

        empty = []
        for element in self.elements:
            if isinstance(element, PolygonSet):
                ii = 0
                while ii < len(element.polygons):
                    if test(element.polygons[ii], element.layers[ii],
                            element.datatypes[ii]):
                        element.polygons.pop(ii)
                        element.layers.pop(ii)
                        element.datatypes.pop(ii)
                    else:
                        ii += 1
                if len(element.polygons) == 0:
                    empty.append(element)
        for element in empty:
            self.elements.remove(element)
        return self