def make_poem_html(poem, pid):
    """This function makes a section of HTML code for a poem.

    Args:
        poem: A poem defined as a list (rows) of lists (words in rows).
        pid: HTML <p> tag ID attribute for CSS identification.

    Returns:
        A string containing HTML code for displaying a poem, for example:

        '<p id="poemline">Day, Morning, Sun,</p><p id="poemline">Birds, Trees, Grass.</p>'
    """
    res_html = ''
    for line in poem[:-1]:
        res_html += '<p id="' + pid + '">'
        for word in line:
            res_html += word + ', '
        res_html += '</p>'
    res_html += '<p id="' + pid + '">'
    for word in poem[-1][:-1]:
        res_html += word + ', '
    res_html += poem[-1][-1] + '.</p>'
    return res_html