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.
policy = [d for d in docs if d["PolicyName"] == policy_name]
    if policy:
        return policy[0]
    
    res_qualifier = func_qualifier(function, qualifier)
    policy = [d for d in docs if d["Statement"][0]["Resource"] == res_qualifier]
    return (policy or [None])[0]
def get_lambda_policy_name(resource_name: str, qualifier: str = None) -> str:
    qualifier = qualifier or "latest"
    if ":function:" in resource_name:
        resource_name = function_name_from_arn(resource_name)
    return LAMBDA_POLICY_NAME_PATTERN.format(name=resource_name, qualifier=qualifier)
def lookup_function(function, region, request_url):
    result = {
        "Configuration": function,
        "Code": {"Location": "%s/code" % request_url},
        "Tags": function["Tags"],
    }
    lambda_details = region.lambdas.get(function["FunctionArn"])
    
    
    if lambda_details.package_type == "Image":
        result["Code"] = lambda_details.code
        result["Configuration"]["CodeSize"] = 0
        del result["Configuration"]["Handler"]
        del result["Configuration"]["Layers"]
    if lambda_details.concurrency is not None:
        result["Concurrency"] = lambda_details.concurrency
    return jsonify(result)
def not_found_error(ref=None, msg=None):