<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def save_all(polyfile):
 """Save all polygon filters"""

        nump = len(PolygonFilter.instances)
        if nump == 0:
            raise PolygonFilterError("There are not polygon filters to save.")
        for p in PolygonFilter.instances:
            # we return the ret_obj, so we don't need to open and
            # close the file multiple times.
            polyobj = p.save(polyfile, ret_fobj=True)
        polyobj.close()