human
I wrote the below code

    if (not os.path.isdir(dir)):
        raise IOError(('Not    a    directory:    %r' % (dir,)))
    if (not filter):
        filter = (lambda path: True)
    def create_zip_file():
        try:
            return ZipFile(out_path, mode='w', compression=ZIP_DEFLATED)
        except RuntimeError:
            return ZipFile(out_path, mode='w', compression=ZIP_STORED)
    with create_zip_file() as zip_file:
        for (dirpath, dirnames, filenames) in os.walk(dir, followlinks=True):
            for filename in filenames:
                path = os.path.join(dirpath, filename)
                rel_path = os.path.relpath(path, dir)
                if filter(rel_path):
                    real_path = os.path.realpath(path)
                    path_in_zip_file = os.path.join(prefix, rel_path)
                    zip_file.write(real_path, arcname=path_in_zip_file)

What's a good function header?
 Here's a good function header?
assistant
#Here's a good function header.

def zip_dir(dir, out_path, filter=None, prefix=''):