<prompt> Kutoa mfano wa hali lambda kazi  <response>: A stateful lambda function is a function that preserves state information between multiple invocations. This can be done in various ways, such as using database storage or external data stores. Here is an example of a stateful lambda function using Amazon DynamoDB to store state information between invocations in Python:pythonimport boto3def lambda_handlerevent, context: dynamodb boto3.resourcedynamodb table dynamodb.TablemyLambdaCounterTable result table.update_item Key id: myLambdaFunctionCounter, UpdateExpression ADD invocationCount :increment, ExpressionAttributeValues :increment: 1, ReturnValues UPDATED_NEW currentCount resultAttributesinvocationCount return statusCode: 200, body: This function has been invoked times..formatcurrentCount This function uses Amazon DynamoDB as a data store to keep track of the number of times the lambda function has been invoked. Each time the function is invoked, it increments the counter stored in the DynamoDB table and returns the updated value. Since the state information is stored externally, it is preserved between multiple invocations of the function, making it stateful. 