<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def show_patterned_file(dir_path, pattern=list(), filename_only=True):
 """Print all file that file name contains ``pattern``. """

        pattern = [i.lower() for i in pattern]
        if filename_only:
            def filter(winfile):
                for p in pattern:
                    if p in winfile.fname.lower():
                        return True
                return False
        else:
            def filter(winfile):
                for p in pattern:
                    if p in winfile.abspath.lower():
                        return True
                return False
        
        fc = FileCollection.from_path_by_criterion(
            dir_path, filter, keepboth=False)
        if filename_only:
            fc.sort_by("fname")
        else:
            fc.sort_by("abspath")
            
        table = {p: "<%s>" % p for p in pattern}
        lines = list()
        lines.append("Results:")
        for winfile in fc.iterfiles():
            lines.append("  %s" % winfile)
            
        if filename_only:
            lines.append("Above are all files that file name contains %s" % pattern)
        else:
            lines.append("Above are all files that abspath contains %s" % pattern)
            
        text = "\n".join(lines)
        print(text)
        with open("__show_patterned_file__.log", "wb") as f:
            f.write(text.encode("utf-8"))