def parse_lines(source):
    source = (_preprocess_line(line) for line in source)

    title_page_lines = list(takewhile(lambda line: line != '', source))
    title_page = parse_title_page(title_page_lines)

    if title_page:
        # The first lines were a title page.
        # Parse the rest of the source as screenplay body.
        return Screenplay(title_page, parse_body(source))
    else:
        # The first lines were not a title page.
        # Parse them as part of the screenplay body.
        return Screenplay(
            {},
            parse_body(itertools.chain(title_page_lines, [''], source))
        )
Helper to determine if model instance is from the DB.
dataset/ETHPy150Open vilcans/screenplain/screenplain/parsers/fountain.py/parse_lines--crossover with--dataset/ETHPy150Open djangonauts/django-hstore/django_hstore/fields.py/SerializedDictionaryField._from_db