def connect_cancel(self, functions):
self._cancel_functions = []<EOL>for func in functions:<EOL><INDENT>if isinstance(func, str) and hasattr(self, func) and callable(getattr(self, func)):<EOL><INDENT>self._cancel_functions.append(getattr(self, func))<EOL><DEDENT>elif callable(func):<EOL><INDENT>self._cancel_functions.append(func)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % str(func))<EOL><DEDENT><DEDENT>
Run given functions when a run is cancelled.