def update_item(self, table_name, hash_key, range_key=None, actions=None, attribute_updates=None, condition=None, expected=None, return_consumed_capacity=None, conditional_operator=None, return_item_collection_metrics=None, return_values=None):
    '\n        Performs the UpdateItem operation\n        '
    self._check_actions(actions, attribute_updates)
    self._check_condition('condition', condition, expected, conditional_operator)
    operation_kwargs = {TABLE_NAME: table_name}
    operation_kwargs.update(self.get_identifier_map(table_name, hash_key, range_key))
    name_placeholders = {}
    expression_attribute_values = {}
    if (condition is not None):
        condition_expression = condition.serialize(name_placeholders, expression_attribute_values)
        operation_kwargs[CONDITION_EXPRESSION] = condition_expression
    if return_consumed_capacity:
        operation_kwargs.update(self.get_consumed_capacity_map(return_consumed_capacity))
    if return_item_collection_metrics:
        operation_kwargs.update(self.get_item_collection_map(return_item_collection_metrics))
    if return_values:
        operation_kwargs.update(self.get_return_values_map(return_values))
    if ((not actions) and (not attribute_updates)):
        raise ValueError('{0} cannot be empty'.format(ATTR_UPDATES))
    actions = (actions or [])
    attribute_updates = (attribute_updates or {})
    update_expression = Update(*actions)
    for key in sorted(attribute_updates.keys()):
        path = Path([key])
        update = attribute_updates[key]
        action = update.get(ACTION)
        if (action not in ATTR_UPDATE_ACTIONS):
            raise ValueError('{0} must be one of {1}'.format(ACTION, ATTR_UPDATE_ACTIONS))
        value = update.get(VALUE)
        (attr_type, value) = self.parse_attribute(value, return_type=True)
        if ((attr_type is None) and (action != DELETE)):
            attr_type = self.get_attribute_type(table_name, key, value)
        value = {attr_type: value}
        if (action == DELETE):
            action = (path.remove() if (attr_type is None) else path.delete(value))
        elif (action == PUT):
            action = path.set(value)
        else:
            action = path.add(value)
        update_expression.add_action(action)
    operation_kwargs[UPDATE_EXPRESSION] = update_expression.serialize(name_placeholders, expression_attribute_values)
    conditional_operator = self.get_conditional_operator((conditional_operator or AND))
    if expected:
        condition_expression = self._get_condition_expression(table_name, expected, conditional_operator, name_placeholders, expression_attribute_values)
        operation_kwargs[CONDITION_EXPRESSION] = condition_expression
    if name_placeholders:
        operation_kwargs[EXPRESSION_ATTRIBUTE_NAMES] = self._reverse_dict(name_placeholders)
    if expression_attribute_values:
        operation_kwargs[EXPRESSION_ATTRIBUTE_VALUES] = expression_attribute_values
    try:
        return self.dispatch(UPDATE_ITEM, operation_kwargs)
    except BOTOCORE_EXCEPTIONS as e:
        raise UpdateError('Failed to update item: {0}'.format(e), e)
Performs the UpdateItem operation
def update_item(self, table_name, hash_key, range_key=None, actions=None, attribute_updates=None, condition=None, expected=None, return_consumed_capacity=None, conditional_operator=None, return_item_collection_metrics=None, return_values=None):
    '\n        \n        '
    self._check_actions(actions, attribute_updates)
    self._check_condition('condition', condition, expected, conditional_operator)
    operation_kwargs = {TABLE_NAME: table_name}
    operation_kwargs.update(self.get_identifier_map(table_name, hash_key, range_key))
    name_placeholders = {}
    expression_attribute_values = {}
    if (condition is not None):
        condition_expression = condition.serialize(name_placeholders, expression_attribute_values)
        operation_kwargs[CONDITION_EXPRESSION] = condition_expression
    if return_consumed_capacity:
        operation_kwargs.update(self.get_consumed_capacity_map(return_consumed_capacity))
    if return_item_collection_metrics:
        operation_kwargs.update(self.get_item_collection_map(return_item_collection_metrics))
    if return_values:
        operation_kwargs.update(self.get_return_values_map(return_values))
    if ((not actions) and (not attribute_updates)):
        raise ValueError('{0} cannot be empty'.format(ATTR_UPDATES))
    actions = (actions or [])
    attribute_updates = (attribute_updates or {})
    update_expression = Update(*actions)
    for key in sorted(attribute_updates.keys()):
        path = Path([key])
        update = attribute_updates[key]
        action = update.get(ACTION)
        if (action not in ATTR_UPDATE_ACTIONS):
            raise ValueError('{0} must be one of {1}'.format(ACTION, ATTR_UPDATE_ACTIONS))
        value = update.get(VALUE)
        (attr_type, value) = self.parse_attribute(value, return_type=True)
        if ((attr_type is None) and (action != DELETE)):
            attr_type = self.get_attribute_type(table_name, key, value)
        value = {attr_type: value}
        if (action == DELETE):
            action = (path.remove() if (attr_type is None) else path.delete(value))
        elif (action == PUT):
            action = path.set(value)
        else:
            action = path.add(value)
        update_expression.add_action(action)
    operation_kwargs[UPDATE_EXPRESSION] = update_expression.serialize(name_placeholders, expression_attribute_values)
    conditional_operator = self.get_conditional_operator((conditional_operator or AND))
    if expected:
        condition_expression = self._get_condition_expression(table_name, expected, conditional_operator, name_placeholders, expression_attribute_values)
        operation_kwargs[CONDITION_EXPRESSION] = condition_expression
    if name_placeholders:
        operation_kwargs[EXPRESSION_ATTRIBUTE_NAMES] = self._reverse_dict(name_placeholders)
    if expression_attribute_values:
        operation_kwargs[EXPRESSION_ATTRIBUTE_VALUES] = expression_attribute_values
    try:
        return self.dispatch(UPDATE_ITEM, operation_kwargs)
    except BOTOCORE_EXCEPTIONS as e:
        raise UpdateError('Failed to update item: {0}'.format(e), e)