'Initialize per-spider redis queue.
Parameters
server : StrictRedis
Redis client instance.
spider : Spider
Scrapy spider instance.
key: str
Redis key where to put and get messages.
serializer : object
Serializer object with ``loads`` and ``dumps`` methods.'

def __init__(self, server, spider, key, serializer=None):

    if (serializer is None):
        serializer = picklecompat
    if (not hasattr(serializer, 'loads')):
        raise TypeError(("serializer    does    not    implement    'loads'    function:    %r" % serializer))
    if (not hasattr(serializer, 'dumps')):
        raise TypeError(("serializer    '%s'    does    not    implement    'dumps'    function:    %r" % serializer))
    self.server = server
    self.spider = spider
    self.key = (key % {'spider': spider.name})
    self.serializer = serializer
