Compute the boundaries to pass to zrangebylex depending of the filter type

        The third return value, ``exclude`` is ``None`` except for the filters
        `lt` and `gt` because we cannot explicitly exclude it when
         querying the sorted-set

        For the parameters, see BaseRangeIndex.store

        Notes
        -----
        For zrangebylex:
        - `(` means "not included"
        - `[` means "included"
        - `\xff` is the last char, it allows to say "starting with"
        - `-` alone means "from the very beginning"
        - `+` alone means "to the very end"

def get_boundaries(self, filter_type, value):
        """Compute the boundaries to pass to zrangebylex depending of the filter type

        The third return value, ``exclude`` is ``None`` except for the filters
        `lt` and `gt` because we cannot explicitly exclude it when
         querying the sorted-set

        For the parameters, see BaseRangeIndex.store

        Notes
        -----
        For zrangebylex:
        - `(` means "not included"
        - `[` means "included"
        - `\xff` is the last char, it allows to say "starting with"
        - `-` alone means "from the very beginning"
        - `+` alone means "to the very end"

        """

        assert filter_type in self.handled_suffixes

        start = '-'
        end = '+'
        exclude = None

        if filter_type in (None, 'eq'):
            # we include the separator to only get the members with the exact value
            start = u'[%s%s' % (value, self.separator)
            end = start.encode('utf-8') + b'\xff'

        elif filter_type == 'gt':
            # starting at the value, excluded
            start = u'(%s' % value
            exclude = value

        elif filter_type == 'gte':
            # starting at the value, included
            start = u'[%s' % value

        elif filter_type == 'lt':
            # ending with the value, excluded
            end = u'(%s' % value
            exclude = value

        elif filter_type == 'lte':
            # ending with the value, included (but not starting with, hence the separator)
            end = u'[%s%s' % (value, self.separator)
            end = end.encode('utf-8') + b'\xff'

        elif filter_type == 'startswith':
            # using `\xff` to simulate "startswith"
            start = u'[%s' % value
            end = start.encode('utf-8') + b'\xff'

        return start, end, exclude