1def check_file(check_function, filename, string): 2 obj = check_function(filename, 'url') 3 result = [] 4 result.append(obj.before()) 5 for i, line in enumerate(string.splitlines(True)): 6 result.append(obj.check_line(i + 1, line)) 7 result.append(obj.after()) 8 return [r for r in result if r is not None] 9