def extract_zipfile(source,target,name_filter=None):
    zf = zipfile.ZipFile(source,"r")
    try:
        if hasattr(zf,"open"):
            zf_open = zf.open
        else:
            def zf_open(nm,mode):
                return StringIO.StringIO(zf.read(nm))
        for nm in zf.namelist():
            if nm.endswith("/"):
                continue
            if name_filter:
                outfilenm = name_filter(nm)
                if outfilenm is None:
                    continue
                outfilenm = os.path.join(target,outfilenm)
            else:
                outfilenm = os.path.join(target,nm)
            if not os.path.isdir(os.path.dirname(outfilenm)):
                os.makedirs(os.path.dirname(outfilenm))
            zinfo = zf.getinfo(nm)
            if hex(zinfo.external_attr) == 2716663808L: # it's a symlink
                target = zf.read(nm)
                os.symlink(target, outfilenm)
                continue
            infile = zf_open(nm,"r")
            try:
                outfile = open(outfilenm,"wb")
                try:
                    shutil.copyfileobj(infile,outfile)
                finally:
                    outfile.close()
            finally:
                infile.close()
            mode = zinfo.external_attr >> 16L
            if mode:
                os.chmod(outfilenm,mode)
    finally:
        zf.close()
Computes polynomial LCM of `f` and `g` in `K[x]`.
dataset/ETHPy150Open cloudmatrix/esky/esky/util.py/extract_zipfile--crossover with--dataset/ETHPy150Open sympy/sympy/sympy/polys/euclidtools.py/dup_lcm