def METHOD_NAME(zip_path, extract_path, password=b"infected", recursion_depth=1):
    """Extracts a nested ZIP file.
    @param zip_path: ZIP path
    @param extract_path: where to extract
    @param password: ZIP password
    @param recursion_depth: how deep we are in a nested archive
    """
    # Test if zip file contains a file named as itself.
    if is_overwritten(zip_path):
        log.debug("ZIP file contains a file with the same name, original will be overwritten")
        # TODO: add random string.
        new_zip_path = f"{zip_path}.old"
        shutil.move(zip_path, new_zip_path)
        zip_path = new_zip_path
    # requires bytes not str
    if isinstance(password, str):
        password = password.encode()
    # Extraction.
    with ZipFile(zip_path, "r") as archive:
        # Check if the archive is encrypted
        for zip_info in archive.infolist():
            is_encrypted = zip_info.flag_bits & 0x1
            # If encrypted and the user didn't provide a password
            # set to default value
            if is_encrypted and (password in (b"", b"infected")):
                log.debug("Archive is encrypted, using default password value: infected")
                if password == b"":
                    password = b"infected"
            # Else, either password stays as user specified or archive is not encrypted
        try:
            archive.extractall(path=extract_path, pwd=password)
        except BadZipfile as e:
            raise CuckooPackageError("Invalid Zip file") from e
        except RuntimeError:
            # Try twice, just for kicks
            try:
                archive.extractall(path=extract_path, pwd=password)
            except RuntimeError as e:
                raise CuckooPackageError(f"Unable to extract Zip file: {e}") from e
        finally:
            if recursion_depth < 4:
                # Extract nested archives.
                for name in archive.namelist():
                    if name.endswith(".zip"):
                        # Recurse.
                        try:
                            METHOD_NAME(
                                os.path.join(extract_path, name),
                                extract_path,
                                password=password,
                                recursion_depth=recursion_depth + 1,
                            )
                        except BadZipfile:
                            log.warning("Nested file '%s' name ends with .zip extension is not a valid Zip. Skip extraction", name)
                        except RuntimeError as run_err:
                            log.error("Error extracting nested Zip file %s with details: %s", name, run_err)