<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _encode_uvarint(data, n):
    ''' Encodes integer into variable-length format into data.'''
    if n < 0:
        raise ValueError('only support positive integer')
    while True:
        this_byte = n & 0x7f
        n >>= 7
        if n == 0:
            data.append(this_byte)
            break
        data.append(this_byte | 0x80)