code: def failure(self, e):
      assert not self.is_done, "Future is already complete"
      self.exception = e if type(e) is not type else e()
      assert isinstance(
          self.exception, BaseException
      ), "future failed without an exception"
      self.is_done = True
      self._call_backs("errback", self._errbacks, self.exception)
      return self
  
file_path: kafka-python/kafka/future.py
imports: from __future__ import absolute_import
  import functools
  import logging
label_desc: Use image node_id 6 for calling the Future obj's underlying member method code with example usage: obj.failure(e) and returns: self