def parse_title_page(lines):
    result = {}

    it = iter(lines)
    try:
        line = it.next()
        while True:
            key_match = title_page_key_re.match(line)
            if not key_match:
                return None
            key, value = key_match.groups()
            if value:
                # Single line key/value
                result.setdefault(key, []).append(value)
                line = it.next()
            else:
                for line in it:
                    value_match = title_page_value_re.match(line)
                    if not value_match:
                        break
                    result.setdefault(key, []).append(value_match.group(1))
                else:
                    # Last line has been processed
                    break
    except StopIteration:
        pass
    return result
Parse the title page.
dataset/ETHPy150Open vilcans/screenplain/screenplain/parsers/fountain.py/parse_title_page