def trim_empty_lines(text):
    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)
Trim leading and trailing empty lines from the given text.
dataset/ETHPy150Open xolox/python-humanfriendly/humanfriendly/text.py/trim_empty_lines