<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_view_file_mapping(self, pattern, cls):
 """Adds a mapping between a file and a view class. Pattern can be an extension in the form .EXT or a filename. """

        if isinstance(pattern, str):
            if not pattern.endswith("*"):
                _, ext = os.path.splitext(pattern)
                self.allowed_extensions.add(ext)
            pattern = re.compile("^" + re.escape(pattern).replace("\\*", ".+") + "$", re.I)
        self.view_class_files_map.append((pattern, cls))