code: def consumer(self, fn):
          
          if self._consumer_fn is not None:
              raise ValueError('Consumer function is already defined for this '
                               'Stream instance')
          if not any([asyncio.iscoroutine(fn), asyncio.iscoroutinefunction(fn)]):
              raise ValueError('Consumer function must be a coroutine')
          self._consumer_fn = fn
docs: Consumer decorator
  
          :param fn: coroutine consumer function
  
          Example:
  
          >>> api = StreamingAPI('my_service_key')
          >>> stream = api.get_stream()
  
          >>> @stream.consumer
          >>> @asyncio.coroutine
          >>> def handle_event(payload):
          >>>     print(payload)