def match_formats(self, bofbuffer, eofbuffer):
        self.current_count += 1
        #t0 = time.clock()
        result = []
        container_result = []
        for format in self.formats:
            try:
                self.current_format = format
                if self.as_good_as_any(format, result):
                    for sig in self.get_signatures(format):
                        self.current_sig = sig
                        success = True
                        for pat in self.get_patterns(sig):
                            self.current_pat = pat
                            pos = self.get_pos(pat)
                            regex = self.get_regex(pat)
                            #print 'trying ', regex
                            if pos == 'BOF':
                                if not re.match(regex, bofbuffer):
                                    success = False
                                    break
                            elif pos == 'EOF':
                                if not re.search(regex, eofbuffer):
                                    success = False
                                    break
                            elif pos == 'VAR':
                                if not re.search(regex, bofbuffer):
                                    success = False 
                                    break
                            elif pos == 'IFB':
                                if not re.search(regex, bofbuffer):
                                    success = False 
                                    break
                        if success:
                            result.append((format, sig))
                            # check if file needs to be parsed with container signature
                            # we skip files with extension "zip" (x-fmt/263)
                            ext = os.path.splitext(self.current_file)[1].lower().lstrip(".")
                            if format.find('puid').text in self.puidTriggers and ext != "zip":
                                container_result = self.read_container(bofbuffer,result)
                                if len(container_result) != 0:
                                    for (k,v) in container_result:
                                        result.append((k,v))
                            break
            except Exception as e:
                sys.stderr.write(str(e)+"\n")
                continue
            # TODO: MdR: needs some <3
            #print "Unexpected error:", sys.exc_info()[0], e
            #sys.stdout.write('***', self.get_puid(format), regex)
            
        #        t1 = time.clock()
        #        if t1 - t0 > 0.02:
        #            print >> sys.stderr, "FIDO: Slow ID", self.current_file
        result = [match for match in result if self.as_good_as_any(match[0], result)]
        result = list(set(result)) # remove duplicate results, this is due to ??? in self.read_container(), needs fix
        return result
Apply the patterns for formats to the supplied buffers.
dataset/ETHPy150Open openpreserve/fido/fido/fido.py/Fido.match_formats