def delete_state(key, namespace=None, table_name=None, environment=None,<EOL>layer=None, stage=None, shard_id=None, consistent=True,<EOL>wait_exponential_multiplier=<NUM_LIT>,<EOL>wait_exponential_max=<NUM_LIT>, stop_max_delay=<NUM_LIT>):
if table_name is None:<EOL><INDENT>table_name = _state_table_name(environment=environment, layer=layer,<EOL>stage=stage)<EOL><DEDENT>if not table_name:<EOL><INDENT>msg = ("<STR_LIT>"<EOL>"<STR_LIT>".format(key))<EOL>logger.error(msg)<EOL>raise StateTableError(msg)<EOL>return<EOL><DEDENT>dynamodb = boto3.resource("<STR_LIT>")<EOL>table = dynamodb.Table(table_name)<EOL>logger.info("<STR_LIT>".format(key, table_name))<EOL>if namespace:<EOL><INDENT>key = "<STR_LIT>".format(namespace, key)<EOL><DEDENT>if shard_id:<EOL><INDENT>key = "<STR_LIT>".format(shard_id, key)<EOL><DEDENT>@retry(retry_on_exception=_is_critical_exception,<EOL>wait_exponential_multiplier=<NUM_LIT>,<EOL>wait_exponential_max=<NUM_LIT>,<EOL>stop_max_delay=<NUM_LIT>)<EOL>def delete_item():<EOL><INDENT>try:<EOL><INDENT>return table.delete_item(Key={"<STR_LIT:id>": key})<EOL><DEDENT>except Exception as err:<EOL><INDENT>if _is_dynamodb_critical_exception(err):<EOL><INDENT>raise CriticalError(err)<EOL><DEDENT>else:<EOL><INDENT>raise<EOL><DEDENT><DEDENT><DEDENT>resp = delete_item()<EOL>logger.info("<STR_LIT>".format(resp))<EOL>return resp<EOL>
Delete Lambda state value.