<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _format_lines(lines):
 """Format the individual lines This will replace the '{', '}' and '~' characters of our mini Return a list of formatted lines. """

    result = lines[:1]
    stack = [0]
    stackcnt = [0]
    for line in lines[1:]:
        if line.startswith('{'):
            if stackcnt[-1]:
                s = u('and   ')
            else:
                s = u('where ')
            stack.append(len(result))
            stackcnt[-1] += 1
            stackcnt.append(0)
            result.append(u(' +') + u('  ')*(len(stack)-1) + s + line[1:])
        elif line.startswith('}'):
            stack.pop()
            stackcnt.pop()
            result[stack[-1]] += line[1:]
        else:
            assert line[0] in ['~', '>']
            stack[-1] += 1
            indent = len(stack) if line.startswith('~') else len(stack) - 1
            result.append(u('  ')*indent + line[1:])
    assert len(stack) == 1
    return result