@classmethod
def parse_protocol(cls, previous_buffer, input_buffer, gevent_queue,
    separator=b'\n', single_item_processing=False):
    """
        Parse a received protocol.
        - For all COMPLETE token : enqueue in the provided queue (method : put)
        - Return the remaining INCOMPLETE token (ie not 
 terminated)
        - Return None if no INCOMPLETE token remains
        :param cls: Our class.
        :param previous_buffer: The previous incomplete buffer.
        :type previous_buffer: bytes,None
        :param input_buffer: The new buffer.
        :type input_buffer: bytes,None
        :param gevent_queue: A gevent queue, which will be populated with complete items.
        :type gevent_queue: Queue
        :param separator: The separator to use
        :type separator: bytes
        :param single_item_processing: If true, process only one item then exit.
        :type single_item_processing: bool
        :return: The new incomplete buffer.
        :rtype bytes
        """
    prev_buf = previous_buffer
    if input_buffer:
        cur_buf = input_buffer
    else:
        cur_buf = b''
    if prev_buf:
        cur_buf = prev_buf + cur_buf
        prev_buf = None
    while True:
        ar = cur_buf.partition(separator)
        if len(ar[1]) > 0:
            if prev_buf is None:
                gevent_queue.put(ar[0])
            else:
                gevent_queue.put(previous_buffer + ar[0])
                prev_buf = None
            if len(ar[2]) == 0:
                return prev_buf
            elif not single_item_processing:
                cur_buf = ar[2]
            else:
                return ar[2]
        elif len(ar[0]) == 0:
            if prev_buf is None:
                return None
            elif len(prev_buf) > 0:
                return prev_buf
            else:
                return None
        elif prev_buf is None:
            return ar[0]
        else:
            return prev_buf + ar[0]
