def delete_max_length(data_in, data_out=None, max_length=20):
    """
    Delete phrases with more than `max_length` characters.
    """
    idx_to_remove = [count for count, sent in enumerate(data_in)
                        if len(sent) > max_length]
    print(idx_to_remove)
    for idx in reversed(idx_to_remove):
        del data_in[idx]
        if data_out is not None:
            del data_out[idx]

    if data_out is not None:
        idx_to_remove = [count for count, sent in enumerate(data_out)
                            if len(sent) > max_length]
        for idx in reversed(idx_to_remove):
            del data_in[idx]
            del data_out[idx]
        return data_in, data_out
    else:
        return data_in