def _process_contains_filter_directive(filter_operation_info, location, context, parameters):
    """Return a Filter basic block that checks if the directive arg is contained in the field.

    Args:
        filter_operation_info: FilterOperationInfo object, containing the directive and field info
                               of the field where the filter is to be applied.
        location: Location where this filter is used.
        context: dict, various per-compilation data (e.g. declared tags, whether the current block
                 is optional, etc.). May be mutated in-place in this function!
        parameters: list of 1 element, specifying the collection in which the value must exist;
                    if the collection is optional and missing, the check will return True

    Returns:
        a Filter basic block that performs the contains check
    """
    filtered_field_type = filter_operation_info.field_type
    filtered_field_name = filter_operation_info.field_name

    base_field_type = strip_non_null_from_type(filtered_field_type)
    if not isinstance(base_field_type, GraphQLList):
        raise GraphQLCompilationError(u'Cannot apply "contains" to non-list '
                                      u'type {}'.format(filtered_field_type))

    argument_inferred_type = strip_non_null_from_type(base_field_type.of_type)
    argument_expression, non_existence_expression = _represent_argument(
        location, context, parameters[0], argument_inferred_type)

    filter_predicate = expressions.BinaryComposition(
        u'contains', expressions.LocalField(filtered_field_name), argument_expression)
    if non_existence_expression is not None:
        # The argument comes from an optional block and might not exist,
        # in which case the filter expression should evaluate to True.
        filter_predicate = expressions.BinaryComposition(
            u'||', non_existence_expression, filter_predicate)

    return blocks.Filter(filter_predicate)
Return a Filter basic block that checks if the directive arg is contained in the field.

    Args:
        filter_operation_info: FilterOperationInfo object, containing the directive and field info
                               of the field where the filter is to be applied.
        location: Location where this filter is used.
        context: dict, various per-compilation data (e.g. declared tags, whether the current block
                 is optional, etc.). May be mutated in-place in this function!
        parameters: list of 1 element, specifying the collection in which the value must exist;
                    if the collection is optional and missing, the check will return True

    Returns:
        a Filter basic block that performs the contains check