Locate the pattern.

def locate(self, pattern, big_endian=False):
        """Locate the pattern."""
        space, self.space = tee(self.space)
        if pattern.startswith('0x'):
            target = unhexlify(
                pattern[2:].encode('utf-8')).decode('utf-8')
            if not big_endian:
                target = target[::-1]
        else:
            target = pattern
        for index, one in enumerate(window(space, self.position)):
            if ''.join(one) == target[:self.position]:
                return index
        raise KeyError('{target} Not Found In {sets}!'.format(
            target=pattern, sets=self.sets))