def METHOD_NAME(self, f: Filter, direction):
    if not FilterChain.validate_direction(direction):
        raise TypeError("Filter chain direction {} is not supported.".format(direction))
    if not isinstance(f, Filter):
        raise TypeError(f"task data filter must be Filter but got {type(f)}")
    f.set_prop(FilterContextKey.CHAIN_TYPE, FilterChainType.TASK_DATA_CHAIN)
    f.set_prop(FilterContextKey.SOURCE, FilterSource.SITE)
    if direction == FilterKey.INOUT:
        self.task_data_filters[FilterKey.IN].append(f)
        self.task_data_filters[FilterKey.OUT].append(f)
    else:
        self.task_data_filters.get(direction).append(f)