def apply_masks(time, flux, flux_err, transit_masks):
    """
    Apply transit masks to the unflattened light curve.

    Args:
        time (array): The time array.
        flux (array): The flux array
        flux_err (array): The flux_err array.
        transit_masks (list): A list of transit masks.

    Returns:
        masked_time (array): The masked time array.
        masked_flux (array): The masked flux array.
        masked_flux_err (array): The masked flux_err array.

    """
    masked_time = time * 1
    masked_flux, masked_flux_err = flux * 1, flux_err * 1
    for i in range(len(transit_masks)):
        masked_time = masked_time[~transit_masks[i]]
        masked_flux = masked_flux[~transit_masks[i]]
        masked_flux_err = masked_flux_err[~transit_masks[i]]
    return masked_time, masked_flux, masked_flux_err
