<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def merge_all_gti_data(datalist_in, nrows, first):
 """ Merge together all the GTI data Parameters ------- datalist_in : list of `astropy.io.fits.BinTableHDU` data The GTI data that is being merged nrows : `~numpy.ndarray` of ints Array with the number of nrows for each object in datalist_in first : `astropy.io.fits.BinTableHDU` BinTableHDU to use as a template Returns ------- out_hdu : `astropy.io.fits.BinTableHDU` BinTableHDU with the merge GTIs """

    max_row = nrows.cumsum()
    min_row = max_row - nrows
    out_hdu = fits.BinTableHDU.from_columns(
        first.columns, header=first.header, nrows=nrows.sum())

    for (imin, imax, data_in) in zip(min_row, max_row, datalist_in):
        for col in first.columns:
            out_hdu.data[col.name][imin:imax] = data_in[col.name]

    return out_hdu