<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def report(self, texts, n_examples=10, context_size=10, f=sys.stdout):
 """Compute statistics of invalid characters and print them. Parameters texts: list of str The texts to search for invalid characters. n_examples: int How many examples to display per invalid character. context_size: int How many characters to return as the context. f: file The file to print the report (default is sys.stdout) """


        result = list(self.compute_report(texts, context_size).items())
        result.sort(key=lambda x: (len(x[1]), x[0]), reverse=True)
        s = 'Analyzed {0} texts.\n'.format(len(texts))
        if (len(texts)) == 0:
            f.write(s)
            return
        if len(result) > 0:
            s += 'Invalid characters and their counts:\n'
            for c, examples in result:
                s += '"{0}"\t{1}\n'.format(c, len(examples))
            s += '\n'
            for c, examples in result:
                s += 'For character "{0}", found {1} occurrences.\nExamples:\n'.format(c, len(examples))
                examples = sample(examples, min(len(examples), n_examples))
                for idx, example in enumerate(examples):
                    s += 'example {0}: {1}\n'.format(idx+1, example)
                s += '\n'
            f.write(s)
        else:
            f.write('All OK\n')