def _update_keywords(self, **update_props):
        """ Update operation for ISO type-specific Keywords metadata: Theme or Place """

        tree_to_update = update_props['tree_to_update']
        prop = update_props['prop']
        values = update_props['values']

        keywords = []

        if prop in KEYWORD_PROPS:
            xpath_root = self._data_map['_keywords_root']
            xpath_map = self._data_structures[prop]

            xtype = xpath_map['keyword_type']
            xroot = xpath_map['keyword_root']
            xpath = xpath_map['keyword']
            ktype = KEYWORD_TYPES[prop]

            # Remove descriptiveKeyword nodes according to type
            for element in get_elements(tree_to_update, xpath_root):
                if get_element_text(element, xtype).lower() == ktype.lower():
                    remove_element(tree_to_update, xpath_root)

            element = insert_element(tree_to_update, 0, xpath_root)
            insert_element(element, 0, xtype, ktype)  # Add the type node

            keywords.extend(update_property(element, xroot, xpath, prop, values))

        return keywords
def _update_keywords ( self , ** update_props ) : tree_to_update = update_props [ 'tree_to_update' ] prop = update_props [ 'prop' ] values = update_props [ 'values' ] keywords = [ ] if prop in KEYWORD_PROPS : xpath_root = self . _data_map [ '_keywords_root' ] xpath_map = self . _data_structures [ prop ] xtype = xpath_map [ 'keyword_type' ] xroot = xpath_map [ 'keyword_root' ] xpath = xpath_map [ 'keyword' ] ktype = KEYWORD_TYPES [ prop ] for element in get_elements ( tree_to_update , xpath_root ) : if get_element_text ( element , xtype ) . lower ( ) == ktype . lower ( ) : remove_element ( tree_to_update , xpath_root ) element = insert_element ( tree_to_update , 0 , xpath_root ) insert_element ( element , 0 , xtype , ktype ) keywords . extend ( update_property ( element , xroot , xpath , prop , values ) ) return keywords
Update operation for ISO type-specific Keywords metadata: Theme or Place