def tokenizepi(string):
    """
	Tokenize the string object ``string`` according to the processing
	instructions in the string. :func:`tokenize` will generate tuples with the
	first item being the processing instruction target and the second being the
	PI data. "Text" content (i.e. anything other than PIs) will be returned as
	``(None, data)``.
	"""
    pos = 0
    while True:
        pos1 = string.find('<?', pos)
        if pos1 < 0:
            part = string[pos:]
            if part:
                yield None, part
            return
        pos2 = string.find('?>', pos1)
        if pos2 < 0:
            part = string[pos:]
            if part:
                yield None, part
            return
        part = string[pos:pos1]
        if part:
            yield None, part
        part = string[pos1 + 2:pos2].strip()
        parts = part.split(None, 1)
        target = parts[0]
        if len(parts) > 1:
            data = parts[1]
        else:
            data = ''
        yield target, data
        pos = pos2 + 2
