<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def run_cleanup(self, env, exit_code):
 """Run cleanup hook when configured."""

        output = []
        if self.pipeline.data.hooks and len(self.pipeline.data.hooks.cleanup) > 0:
            env.update({'PIPELINE_RESULT': 'FAILURE'})
            env.update({'PIPELINE_SHELL_EXIT_CODE': str(exit_code)})
            config = ShellConfig(script=self.pipeline.data.hooks.cleanup,
                                 model=self.pipeline.model, env=env,
                                 dry_run=self.pipeline.options.dry_run,
                                 debug=self.pipeline.options.debug,
                                 strict=self.pipeline.options.strict,
                                 temporary_scripts_path=self.pipeline.options.temporary_scripts_path)
            cleanup_shell = Bash(config)
            for line in cleanup_shell.process():
                output.append(line)
                self.logger.info(" | %s", line)
        return output