# Path: ac_mediator/exceptions.py
# class ACFieldTranslateException(ACException):
#     pass
# 
# class ACException(Exception):
#     msg = None
#     status = None
# 
#     def __init__(self, msg=None, status=None):
# 
#         # Set defaults (if not set in subclass)
#         if self.msg is None:
#             self.msg = ""
#         if self.status is None:
#             self.msg = -1
# 
#         # Override with arguments (if any)
#         if msg is not None:
#             self.msg = msg
#         if status is not None:
#             self.status = status
# 
#     def __repr__(self):
#         return self.msg
# 
# class ACFilterParsingException(ACException):
#     pass
# 
# Path: services/acservice/utils.py
# def parse_filter(filter_string):
#     """
#     Parse a filter string using the 'filterExpr' grammar defined above.
#     This function returns a pyparsing.ParseResults object that should be further
#     processed with the build_filter_string method of a ACServiceTextSearchMixin instance.
#     """
#     return filterExpr.parseString(filter_string, parseAll=True)


from ac_mediator.exceptions import ACFieldTranslateException, ACException, ACFilterParsingException
from services.acservice.constants import *
from services.acservice.utils import parse_filter
import pyparsing
                kwargs.update({'value_range': value})
            filter_list.append(self.render_filter_term(**kwargs))

        elif is_operator(elm):
            # If element is an operator, render and add it to the filter list
            filter_list.append(self.render_operator_term(elm.upper()))

        elif type(elm) == pyparsing.ParseResults:
            # If element is a more complex structure, walk it recursively and add precedence elements () if needed

            if not is_not_structure(elm):
                filter_list.append('(')
            for item in elm:
                self.process_filter_element(item, filter_list)
            if not is_not_structure(elm):
                filter_list.append(')')
        else:
            raise ACFilterParsingException

    def build_filter_string(self, filter_input_value):
        """
        This method gets a filter string defined using the Audio Commons filter string syntax and Audio Commons field
        names and values, and returns a filter string which uses the filtering syntax, filter names and compatible
        values of the individual third party service. Raises `ACFilterParsingException` if problems occur during filter
        parsing. For instance, an input filter like "ac:format:wav AND ac:duration:[2,10]" could be translated to
        something like "format=wav+duration=[2 TO 10]".
        :param filter_input_value: input filter string
        :return: output (translated) filter string
        """
        try:

# Path: ac_mediator/exceptions.py
# class ACFieldTranslateException(ACException):
#     pass
# 
# class ACException(Exception):
#     msg = None
#     status = None
# 
#     def __init__(self, msg=None, status=None):
# 
#         # Set defaults (if not set in subclass)
#         if self.msg is None:
#             self.msg = ""
#         if self.status is None:
#             self.msg = -1
# 
#         # Override with arguments (if any)
#         if msg is not None:
#             self.msg = msg
#         if status is not None:
#             self.status = status
# 
#     def __repr__(self):
#         return self.msg
# 
# class ACFilterParsingException(ACException):
#     pass
# 
# Path: services/acservice/utils.py
# def parse_filter(filter_string):
#     """
#     Parse a filter string using the 'filterExpr' grammar defined above.
#     This function returns a pyparsing.ParseResults object that should be further
#     processed with the build_filter_string method of a ACServiceTextSearchMixin instance.
#     """
#     return filterExpr.parseString(filter_string, parseAll=True)


# Path: services/acservice/search.py
from ac_mediator.exceptions import ACFieldTranslateException, ACException, ACFilterParsingException
from services.acservice.constants import *
from services.acservice.utils import parse_filter
import pyparsing

                kwargs.update({'value_range': value})
            filter_list.append(self.render_filter_term(**kwargs))

        elif is_operator(elm):
            # If element is an operator, render and add it to the filter list
            filter_list.append(self.render_operator_term(elm.upper()))

        elif type(elm) == pyparsing.ParseResults:
            # If element is a more complex structure, walk it recursively and add precedence elements () if needed

            if not is_not_structure(elm):
                filter_list.append('(')
            for item in elm:
                self.process_filter_element(item, filter_list)
            if not is_not_structure(elm):
                filter_list.append(')')
        else:
            raise ACFilterParsingException

    def build_filter_string(self, filter_input_value):
        """
        This method gets a filter string defined using the Audio Commons filter string syntax and Audio Commons field
        names and values, and returns a filter string which uses the filtering syntax, filter names and compatible
        values of the individual third party service. Raises `ACFilterParsingException` if problems occur during filter
        parsing. For instance, an input filter like "ac:format:wav AND ac:duration:[2,10]" could be translated to
        something like "format=wav+duration=[2 TO 10]".
        :param filter_input_value: input filter string
        :return: output (translated) filter string
        """
        try:

            parsed_filter = parse_filter(filter_input_value)