def temp_shapefile_from_zip(zip_path):
    log.info("Creating temporary SHP file from %s" % zip_path)
    zf = ZipFile(zip_path)
    tempdir = mkdtemp()
    shape_path = None
    # Copy the zipped files to a temporary directory, preserving names.
    for name in zf.namelist():
        data = zf.read(name)
        outfile = os.path.join(tempdir, name)
        if name.endswith('.shp'):
            shape_path = outfile
        f = open(outfile, 'w')
        f.write(data)
        f.close()

    if shape_path is None:
        log.warn("No shapefile, cleaning up")
        # Clean up after ourselves.
        for file in os.listdir(tempdir):
            os.unlink(os.path.join(tempdir, file))
        os.rmdir(tempdir)
        raise ValueError("No shapefile found in zip")

    return shape_path
Validates if a code is (still) a valid one. It takes two arguments:
dataset/ETHPy150Open newsapps/django-boundaryservice/boundaryservice/management/commands/loadshapefiles.py/temp_shapefile_from_zip--crossover with--dataset/ETHPy150Open joaoqalves/web2py-oauth2/modules/oauth/storage/__init__.py/web2pyStorage.valid_code