Connects p1 and p2, where p1 and p2 are either to qubit line indices,
        in which case the two most recent gates are connected, or two gate
        indices, in which case line denotes the line number and the two gates
        are connected on the given line.

        :param int p1: Index of the first object to connect.
        :param int p2: Index of the second object to connect.
        :param int line: Line index - if provided, p1 and p2 are gate indices.
        :return: Latex code to draw this / these line(s).
        :rtype: string

def _line(self, p1, p2, line=None):
        """
        Connects p1 and p2, where p1 and p2 are either to qubit line indices,
        in which case the two most recent gates are connected, or two gate
        indices, in which case line denotes the line number and the two gates
        are connected on the given line.

        :param int p1: Index of the first object to connect.
        :param int p2: Index of the second object to connect.
        :param int line: Line index - if provided, p1 and p2 are gate indices.
        :return: Latex code to draw this / these line(s).
        :rtype: string
        """
        dbl_classical = self.settings['lines']['double_classical']

        if line is None:
            quantum = not dbl_classical or self.is_quantum[p1]
            op1, op2 = self._op(p1), self._op(p2)
            loc1, loc2 = 'north', 'south'
            shift = "xshift={}cm"
        else:
            quantum = not dbl_classical or self.is_quantum[line]
            op1, op2 = self._op(line, p1), self._op(line, p2)
            loc1, loc2 = 'west', 'east'
            shift = "yshift={}cm"

        if quantum:
            return "\n\\draw ({}) edge[edgestyle] ({});".format(op1, op2)
        else:
            if p2 > p1:
                loc1, loc2 = loc2, loc1
            edge_str = "\n\\draw ([{shift}]{op1}.{loc1}) edge[edgestyle] ([{shift}]{op2}.{loc2});"
            line_sep = self.settings['lines']['double_lines_sep']
            shift1 = shift.format(line_sep / 2.)
            shift2 = shift.format(-line_sep / 2.)
            edges_str = edge_str.format(shift=shift1, op1=op1, op2=op2, loc1=loc1, loc2=loc2)
            edges_str += edge_str.format(shift=shift2, op1=op1, op2=op2, loc1=loc1, loc2=loc2)
            return edges_str