

def trim_empty_lines(text):
    '\n    Trim leading and trailing empty lines from the given text.\n\n    :param text: The text to trim (a string).\n    :returns: The trimmed text (a string).\n    '
    lines = text.splitlines(True)
    while (lines and is_empty_line(lines[0])):
        lines.pop(0)
    while (lines and is_empty_line(lines[(- 1)])):
        lines.pop((- 1))
    return ''.join(lines)

dataset/ETHPy150Open xolox/python-humanfriendly/humanfriendly/text.py trim_empty_lines/original