import os
from typing import TYPE_CHECKING

import boto3

if TYPE_CHECKING:
    from mypy_boto3_dynamodb.client import DynamoDBClient
else:
    DynamoDBClient = object


def get_dynamodb_client() -> DynamoDBClient:
    if os.getenv('AWS_LAMBDA_FUNCTION_NAME'):
        return boto3.client('dynamodb')

    return boto3.client('dynamodb', endpoint_url='http://127.0.0.1:8000')


dynamodb_client: DynamoDBClient = get_dynamodb_client()
