<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_arrow( self, diagram, number, between, kind, label="", head_length=0.075, font_size=7, color="k" ):
 """Add arrow. Parameters diagram : [column, row] Diagram position. number : integer Arrow position. between : [start, stop] Arrow span. kind : {'ket', 'bra', 'out'} Arrow style. label : string (optional) Arrow label. Default is ''. head_length : number (optional) Arrow head length. Default 0.075. font_size : number (optional) Font size. Default is 7. color : matplotlib color Arrow color. Default is 'k'. Returns ------- list [line, arrow_head, text] """

        column, row = diagram
        x_pos = self.x_pos[number]
        # calculate arrow length
        arrow_length = self.energies[between[1]] - self.energies[between[0]]
        arrow_end = self.energies[between[1]]
        if arrow_length > 0:
            direction = 1
            y_poss = [self.energies[between[0]], self.energies[between[1]] - head_length]
        elif arrow_length < 0:
            direction = -1
            y_poss = [self.energies[between[0]], self.energies[between[1]] + head_length]
        else:
            raise ValueError("Variable between invalid")
        subplot = self.subplots[row][column]
        # add line
        length = abs(y_poss[0] - y_poss[1])
        if kind == "ket":
            line = subplot.plot([x_pos, x_pos], y_poss, linestyle="-", color=color, linewidth=2)
        elif kind == "bra":
            line = subplot.plot([x_pos, x_pos], y_poss, linestyle="--", color=color, linewidth=2)
        elif kind == "out":
            yi = np.linspace(y_poss[0], y_poss[1], 100)
            xi = (
                np.sin((yi - y_poss[0]) * int((1 / length) * 20) * 2 * np.pi * length) / 40 + x_pos
            )
            line = subplot.plot(
                xi, yi, linestyle="-", color=color, linewidth=2, solid_capstyle="butt"
            )
        # add arrow head
        arrow_head = subplot.arrow(
            self.x_pos[number],
            arrow_end - head_length * direction,
            0,
            0.0001 * direction,
            head_width=head_length * 2,
            head_length=head_length,
            fc=color,
            ec=color,
            linestyle="solid",
            linewidth=0,
        )
        # add text
        text = subplot.text(
            self.x_pos[number], -0.1, label, fontsize=font_size, horizontalalignment="center"
        )
        return line, arrow_head, text