in handlers/aws/utils.py [0:0]
def get_lambda_region() -> str:
"""
Get the AWS region where the Lambda function is running.
Returns the value of the `AWS_REGION` environment variable. If the
`AWS_REGION` variable is not set, it returns the value of the
`AWS_DEFAULT_REGION` variable.
If neither variable is set, it raises a `ValueError`.
Returns:
str: The AWS region.
"""
region = os.getenv("AWS_REGION") or os.getenv("AWS_DEFAULT_REGION")
if region is None:
raise ValueError("AWS region not found in environment variables.")
return region