def find_prepositions(chunked):
    """ The input is a list of (token, tag, chunk)-tuples.
        The output is a list of (token, tag, chunk, preposition)-tuples.
        PP-chunks followed by NP-chunks make up a PNP-chunk.
    """
    n = len(chunked) > 0 and len(chunked[0]) or 0
    for i, chunk in enumerate(chunked):
        if chunk[2].endswith("PP") and i<len(chunked)-1 and chunked[i+1][2].endswith("NP"):
            chunk.append("B-PNP")
            for ch in chunked[i+1:]:
                if not ch[2].endswith("NP"): 
                    break
                ch.append("I-PNP")
    # Tokens that are not part of a preposition just get the O-tag.
    for chunk in filter(lambda x: len(x) < n+1, chunked):
        chunk.append("O")
    return chunked