def set_mock_engine(self, engine):
if not engine:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>mock_engine = engine(self)<EOL>methods = ('<STR_LIT>', '<STR_LIT>')<EOL>if not all([hasattr(mock_engine, method) for method in methods]):<EOL><INDENT>raise NotImplementedError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>self.mock_engine = mock_engine<EOL>if self.active:<EOL><INDENT>self.mock_engine.activate()<EOL><DEDENT>
Sets a custom mock engine, replacing the built-in one.

This is particularly useful if you want to replace the built-in
HTTP traffic mock interceptor engine with your custom one.

For mock engine implementation details, see `pook.MockEngine`.

Arguments:
    engine (pook.MockEngine): custom mock engine to use.