def iter_prefix(reader, key):
    """
    Creates an iterator which iterates over lines that start with prefix
    'key' in a sorted text file.
    """

    return itertools.takewhile(
        lambda line: line.startswith(key),
        search(reader, key))
def iter_prefix ( reader , key ) : return itertools . takewhile ( lambda line : line . startswith ( key ) , search ( reader , key ) )
Creates an iterator which iterates over lines that start with prefix
    'key' in a sorted text file.