code: def _add_filter_node(root, filter_, value):
          
          filter_el = ElementTree.SubElement(root, 'Filter')
          filter_el.set('name', filter_.name)
  
          # Set filter value depending on type.
          if filter_.type == 'boolean':
              # Boolean case.
              if value is True or value.lower() in {'included', 'only'}:
                  filter_el.set('excluded', '0')
              elif value is False or value.lower() == 'excluded':
                  filter_el.set('excluded', '1')
              else:
                  raise ValueError('Invalid value for boolean filter ({})'
                                   .format(value))
          elif isinstance(value, list) or isinstance(value, tuple):
              # List case.
              filter_el.set('value', ','.join(map(str, value)))
          else:
              # Default case.
              filter_el.set('value', str(value))
docs: Adds filter xml node to root.