While a lambda is still processing (archive unpacking etc), the lambda state should be set to "Pending" (currently "Active") and invocations to that lambda should fail (currently, it can end up in a inconsistent state in this case, like lambdas being executed without layers).

Lambda state should reflect the current internal state, and invocations should fail if not active.
return
    
    code_sha_256 = base64.standard_b64encode(hashlib.sha256(zip_file_content).digest())
    latest_version = lambda_details.get_version(VERSION_LATEST)
    latest_version["CodeSize"] = len(zip_file_content)
    latest_version["CodeSha256"] = code_sha_256.decode("utf-8")
    tmp_dir = "%s/zipfile.%s" % (config.dirs.tmp, short_uid())
    mkdir(tmp_dir)
    tmp_file = "%s/%s" % (tmp_dir, LAMBDA_ZIP_FILE_NAME)
    save_file(tmp_file, zip_file_content)
    TMP_FILES.append(tmp_dir)
    lambda_details.cwd = tmp_dir
    return tmp_dir
def set_function_code(lambda_function: LambdaFunction):
    def _set_and_configure():
        do_set_function_code(lambda_function)
        
        for plugin in lambda_executors.LambdaExecutorPlugin.get_plugins():
            plugin.init_function_code(lambda_function)
    
    run_for_max_seconds(config.LAMBDA_CODE_EXTRACT_TIME, _set_and_configure)
    return {"FunctionName": lambda_function.name()}
def store_and_get_lambda_code_archive(
    lambda_function: LambdaFunction, zip_file_content: bytes = None
) -> Optional[Tuple[str, str, bytes]]:
    """Store the Lambda code referenced in the LambdaFunction details to disk as a zip file,
    and return the Lambda CWD, file name, and zip bytes content. May optionally return None
    in case this is a Lambda with the special bucket marker __local__, used for code mounting."""
    code_passed = lambda_function.code
    is_local_mount = code_passed.get("S3Bucket") == config.BUCKET_MARKER_LOCAL