def document_image(self):
        """
            Processes an XTAF image including STFS files and embedded GPD and Account files
        """

        if self.filename == None:
            return

        self.output("Opening %s" % self.filename, self.errfd)
        x = partition.Partition(self.filename)
        self.print_xtaf(x)

        # Find STFS files
        self.output("Processing all files", self.errfd)
        for filename in x.allfiles:
            try:
                if xboxmagic.find_type(data = x.read_file(filename, size=0x10)) == "STFS":
                    self.output("Processing STFS file %s" % filename, self.errfd)
                    s = stfs.STFS(filename, fd=x.open_fd(filename))
                    self.print_stfs(s)
                    
                    # Check to see if this is a gamertag STFS  
                    for stfsfile in s.allfiles:
                        try:
                            if stfsfile.endswith("Account"):
                                magic = xboxmagic.find_type(data = s.read_file(s.allfiles[stfsfile], size=404))
                            elif stfsfile.upper().endswith(("PNG", "GPD")): 
                                magic = xboxmagic.find_type(data = s.read_file(s.allfiles[stfsfile], size=0x10))
                            else:
                                magic = 'Unknown'

                            # Process GPD files
                            if magic == 'XDBF':
                                self.output("Processing GPD File %s" % stfsfile, self.errfd)
                                # Maybe STFS needs an equivalent to Partition.open_fd(filename)
                                g = xdbf.XDBF(stfsfile, fd=StringIO(s.read_file(s.allfiles[stfsfile])))
                                self.print_xdbf(g)
                                if self.image_directory != None: # Extract all the images
                                    for gpdimage in g.images:
                                        with open("%s/%s-%x-%s" %\
                                                (self.image_directory, os.path.basename(filename), gpdimage,\
                                                stfsfile[1:].replace('/', '-')), 'w') as fd:
                                            fd.write(g.images[gpdimage])
                                        
                            # Decrypt and print Account blob                       
                            if magic == 'Account':
                                self.output("Processing Account Blob", self.errfd)
                                a = account.Account(s.read_file(s.allfiles[stfsfile]))
                                self.print_account(a)
                            
                            # Extract all the images
                            if magic == 'PNG' and self.image_directory != None:
                                self.output("Processing Image File %s" % stfsfile, self.errfd)  
                                with open("%s/%s-%s.png" %\
                                        (self.image_directory, os.path.basename(filename), stfsfile[1:].replace('/', '-')),\
                                        'w') as fd:
                                    fd.write(s.read_file(s.allfiles[stfsfile]))
                        except (IOError, OverflowError, __HOLE__) as e: # GPD / Account error
                            self.output("GPD/Account Error: %s %s %s" % (stfsfile, type(e), e), self.errfd)
                            continue

            except (IOError, OverflowError, AssertionError) as e: # STFS Error
                self.output("STFS Error: %s %s %s" % (filename, type(e), e), self.errfd)
                continue
dataset/ETHPy150Open arkem/py360/report360.py/Report360.document_image