<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cli(out_fmt, input, output):
 """Converts text."""

    _input = StringIO()
    for l in input:
        try:
            _input.write(str(l))
        except TypeError:
            _input.write(bytes(l, 'utf-8'))
    _input = seria.load(_input)
    _out = (_input.dump(out_fmt))
    output.write(_out)