input: Write a python function to parse a JSON payload and store it in an Amazon S3 bucket.
  assert lambda_handler('{"key": "value"}', None)['statusCode'] == 200
  assert json.loads(lambda_handler('{"name": "test"}', None)['body']) == 'Data stored successfully'
output: import json
  import boto3
  import os
  
  s3 = boto3.client('s3')
  bucket_name = os.getenv('S3_BUCKET_NAME')
  
  def lambda_handler(event, context):
      try:
          data = json.loads(event)
          key = f"{data.get('name', 'default_key')}.json"
          s3.put_object(Bucket=bucket_name, Key=key, Body=json.dumps(data))
          return {
              'statusCode': 200,
              'body': json.dumps('Data stored successfully')
          }
      except Exception as e:
          return {
              'statusCode': 500,
              'body': json.dumps(f'Error storing data: {str(e)}')
          }