def trim(lines):
trim_top = None<EOL>trim_bottom = None<EOL>_lines = lines[:]<EOL>for (lineno, line) in enumerate(_lines):<EOL><INDENT>if hasattr(line, '<STR_LIT>') and line.is_text_line and not line.text.strip():<EOL><INDENT>trim_top = lineno<EOL><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT><DEDENT>for (lineno, line) in enumerate(reversed(_lines)):<EOL><INDENT>if hasattr(line, '<STR_LIT>') and line.is_text_line and not line.text.strip():<EOL><INDENT>trim_bottom = lineno<EOL><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT><DEDENT>if trim_top is not None:<EOL><INDENT>_lines = _lines[trim_top + <NUM_LIT:1>:]<EOL><DEDENT>if trim_bottom is not None:<EOL><INDENT>trim_bottom = len(_lines) - trim_bottom - <NUM_LIT:1><EOL>_lines = _lines[:trim_bottom]<EOL><DEDENT>return _lines<EOL>
Remove lines at the start and at the end of the given `lines` that are :class:`~taxi.timesheet.lines.TextLine`
instances and don't have any text.