<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_bytes(fp, data):
 """ Write bytes to the file object and returns bytes written. :return: written byte size """

    pos = fp.tell()
    fp.write(data)
    written = fp.tell() - pos
    assert written == len(data), 'written=%d, expected=%d' % (
        written, len(data)
    )
    return written