def _get_query_parts(self, query_str, search_options=None):
        """ Split a query string into its parts
        """

        if search_options is None:
            search_options = {}

        if query_str is None:
            raise NipapValueError("'query_string' must not be None")

        # find query parts
        query_str_parts = []
        try:
            for part in shlex.split(query_str.encode('utf-8')):
                query_str_parts.append({ 'string': part.decode('utf-8') })
        except ValueError as exc:
            if unicode(exc) == 'No closing quotation':
                raise NipapValueError(unicode(exc))
            raise exc

        # Handle empty search.
        # We need something to iterate over, but shlex.split() returns
        # zero-element list for an empty string, so we have to append one
        # manually
        if len(query_str_parts) == 0:
            query_str_parts.append({ 'string': '' })

        return query_str_parts
Split a query string into its parts