<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_varint64(self, value):
 """Appends a signed 64-bit integer to the internal buffer, encoded as a varint. """

        if not wire_format.INT64_MIN <= value <= wire_format.INT64_MAX:
            raise errors.EncodeError('Value out of range: %d' % value)
        if value < 0:
            value += (1 << 64)
        self.append_var_uint64(value)