<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def append_var_uint64(self, unsigned_value):
 """Appends an unsigned 64-bit integer to the internal buffer, encoded as a varint. """

        if not 0 <= unsigned_value <= wire_format.UINT64_MAX:
            raise errors.EncodeError('Value out of range: %d' % unsigned_value)
        while True:
            bits = unsigned_value & 0x7f
            unsigned_value >>= 7
            if unsigned_value:
                bits |= 0x80
            self._buffer.append(bits)
            if not unsigned_value:
                break