def dynamodb():
    dynamodb = boto3.resource('dynamodb', **DYNAMODB_CONFIG)

    try:
        dynamodb.Table('users').delete()
    except ClientError as error:
        # you can not just use ResourceNotFoundException class
        # to catch an error since it doesn't exist until it's raised
        if error.__class__.__name__ != 'ResourceNotFoundException':
            raise

    create_users_table(dynamodb)

    # waiting until the table exists
    dynamodb.meta.client.get_waiter('table_exists').wait(TableName='users')

    return dynamodb