<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dump_in_memory_result(self, result, output_path):
 """Recursively dumps the result of our processing into files within the given output path. Args: result: The in-memory result of our processing. output_path: Full path to the folder into which to dump the files. Returns: The number of files generated (integer). """

        file_count = 0
        logger.debug("Dumping in-memory processing results to output folder: %s", output_path)
        for k, v in iteritems(result):
            cur_output_path = os.path.join(output_path, k)

            if isinstance(v, dict):
                file_count += self.dump_in_memory_result(v, cur_output_path)
            else:
                if not os.path.isdir(output_path):
                    os.makedirs(output_path)

                filename = os.path.join(output_path, k)
                logger.debug("Writing output file: %s", filename)
                # dump the contents of the file
                with open(filename, 'wt', encoding=self.config.encoding) as f:
                    f.write(v)

                file_count += 1

        return file_count