def last_line(text):
    """
    Get the last meaningful line of the text, that is the last non-empty line.

    :param text: Text to search the last line
    :type text: str
    :return:
    :rtype: str
    """
    last_line_of_text = ""
    while last_line_of_text == "" and len(text) > 0:
        last_line_start = text.rfind("\n")
        # Handle one-line strings (without \n)
        last_line_start = max(0, last_line_start)
        last_line_of_text = text[last_line_start:].strip("\r\n ")
        text = text[:last_line_start]
    return last_line_of_text
def last_line ( text ) : last_line_of_text = "" while last_line_of_text == "" and len ( text ) > 0 : last_line_start = text . rfind ( "\n" ) last_line_start = max ( 0 , last_line_start ) last_line_of_text = text [ last_line_start : ] . strip ( "\r\n " ) text = text [ : last_line_start ] return last_line_of_text
Get the last meaningful line of the text, that is the last non-empty line.

    :param text: Text to search the last line
    :type text: str
    :return:
    :rtype: str