def check_with_tolerance(self, n, h,t, tolerance):
        '''
            n : int
                offset position, relative to the start of the self.line array
            
            h : obejct numpy.array
                array object populated with an array that we are trying to match, represents head version
                
            t : obejct numpy.array
                array object populated with an array that we are trying to match, represents tail version
                
            tolerance : int
                controls how many flips we can tolerate in the search
            
            for heads arrays match based on sum(h) from line = sum(h)
        '''
        if not len(self.line) > 0:
            return [True, 1, h]
        for offset in np.arange(0,len(self.line),1):
            if self.verbose:
                print 'offset', offset, 'n', n, 'offset+n', offset+n, 'self.line[offset:offset+n]', self.line[offset:offset+n]
            if self.line[offset:offset+n].shape[0] >= h.shape[0] and \
                    self.line[offset:offset+n].shape[0] >= t.shape[0]:
                spread = np.abs(np.sum(self.line[offset:offset+n]) - np.sum(h))
                if spread <= tolerance:
                    return [True, offset, h]
        return [False, 0, None]

            n : int
                offset position, relative to the start of the self.line array
            
            h : obejct numpy.array
                array object populated with an array that we are trying to match, represents head version
                
            t : obejct numpy.array
                array object populated with an array that we are trying to match, represents tail version
                
            tolerance : int
                controls how many flips we can tolerate in the search
            
            for heads arrays match based on sum(h) from line = sum(h)
        
recipes/Python/578779_Find_largest_run_Heads_or_Tails/recipe-578779.py