<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(self, path, outdir, filter_func=None):
 """Extract from a zip file, with an optional filter. :param function filter_func: optional filter with the filename as the parameter. Returns True if the file should be extracted."""

    with open_zip(path) as archive_file:
      for name in archive_file.namelist():
        # While we're at it, we also perform this safety test.
        if name.startswith('/') or name.startswith('..'):
          raise ValueError('Zip file contains unsafe path: {}'.format(name))
        if (not filter_func or filter_func(name)):
          archive_file.extract(name, outdir)