'Register to receive data from a producer.
This sets this selectable to be a consumer for a producer.  When this
selectable runs out of data on a write() call, it will ask the producer
to resumeProducing(). A producer should implement the IProducer
interface.
FileDescriptor provides some infrastructure for producer methods.'

def registerProducer(self, producer, streaming):

    if (self.producer is not None):
        raise RuntimeError(('Cannot    register    producer    %s,    because    producer    %s    was    never    unregistered.' % (producer, self.producer)))
    if (not self.active):
        producer.stopProducing()
    else:
        self.producer = producer
        self.streamingProducer = streaming
        if (not streaming):
            producer.resumeProducing()
