<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _cz_gate(self, lines):
 """ Return the TikZ code for an n-controlled Z-gate. :param lines: List of all qubits involved. :type: list[int] """

        line = lines[0]
        delta_pos = self._gate_offset(Z)
        gate_width = self._gate_width(Z)
        gate_str = self._phase(line, self.pos[line])

        for ctrl in lines[1:]:
            gate_str += self._phase(ctrl, self.pos[line])
            gate_str += self._line(ctrl, line)

        new_pos = self.pos[line] + delta_pos + gate_width
        for i in lines:
            self.op_count[i] += 1
        for i in range(min(lines), max(lines) + 1):
            self.pos[i] = new_pos
        return gate_str