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.
from io import StringIO
from typing import Any, Dict, List, Optional, Tuple
from urllib.parse import urlparse
from flask import Flask, Response, jsonify, request
from localstack import config
from localstack.aws.accounts import get_aws_account_id
from localstack.constants import APPLICATION_JSON
from localstack.services.awslambda import lambda_executors
from localstack.services.awslambda.event_source_listeners.event_source_listener import (
    EventSourceListener,
)
from localstack.services.awslambda.invocation.lambda_util import function_name_from_arn
from localstack.services.awslambda.lambda_executors import InvocationResult, LambdaContext
from localstack.services.awslambda.lambda_utils import (
    API_PATH_ROOT,
    DOTNET_LAMBDA_RUNTIMES,
    LAMBDA_DEFAULT_HANDLER,
    LAMBDA_DEFAULT_RUNTIME,
    LAMBDA_RUNTIME_NODEJS14X,
    ClientError,
    error_response,
    event_source_arn_matches,
    get_executor_mode,
    get_handler_file_from_name,
    get_lambda_runtime,
    get_zip_bytes,
    multi_value_dict_for_list,
)
from localstack.services.generic_proxy import RegionBackend
from localstack.services.install import INSTALL_DIR_STEPFUNCTIONS, install_go_lambda_runtime