def split_by_lines(tokens: list):
    """
    Splits given value token by lines: returns array where each entry is a token list
    for a single line
    """
    result = []
    line = []
    for t in tokens:
        if isinstance(t, str):
            lines = t.splitlines()
            line.append(lines.pop(0) if lines else '')
            while lines:
                result.append(line)
                line = [lines.pop(0) or '']
        else:
            line.append(t)
    if line:
        result.append(line)
    return result
