def read_lines_from_stream(stream, count=None):
    """Read lines from the stream/file object. If a count is specified
    would limit the number of lines read.  If there are fewer lines than count,
    the rest of the list would be None items.
    Empty lines are not filtered out and count as a line.
    """
    # type (Any, int) -> List[Text]
    if not count:
        return [l.strip("\n") for l in stream.readlines()]
    lines = []
    line_counter = 0
    for line in stream:
        line_counter += 1
        lines.append(line.strip("\n"))
        if line_counter >= count:
            break
    if line_counter < count:
        lines.extend([None] * (count - line_counter))
    return lines