def _make_patch(self, patch_location, new=None):
patch_mock = new if new is not None else mock.Mock()<EOL>patcher = mock.patch(patch_location, patch_mock)<EOL>patcher.start()<EOL>self.addCleanup(patcher.stop)<EOL>return patch_mock<EOL>
Patch `patch_location`, register the patch to stop at test cleanup and return mock object.