def det_dataset(eb, passband, dataid, comp, time):

    """
    Since RV datasets can have values related to each component in phoebe2, but are component specific in phoebe1
    , it is important to determine which dataset to add parameters to. This function will do that.
    eb - bundle
    rvpt - relevant phoebe 1 parameters

    """
    rvs = eb.get_dataset(kind='rv').datasets
    #first check to see if there are currently in RV datasets
    if dataid == 'Undefined':
        dataid = None
#    if len(rvs) == 0:
    #if there isn't we add one the easy part

    try:
        eb._check_label(dataid)

        rv_dataset = eb.add_dataset('rv', dataset=dataid, times=[])

    except ValueError:

        logger.warning("The name picked for the radial velocity curve is forbidden. Applying default name instead")
        rv_dataset = eb.add_dataset('rv', times=[])

#     else:
#     #now we have to determine if we add to an existing dataset or make a new one
#         rvs = eb.get_dataset(kind='rv').datasets
#         found = False
#         #set the component of the companion
#
#         if comp == 'primary':
#             comp_o = 'primary'
#         else:
#             comp_o = 'secondary'
#         for x in rvs:
#             test_dataset = eb.get_dataset(x, check_visible=False)
#
#
#             if len(test_dataset.get_value(qualifier='rvs', component=comp_o, check_visible=False)) == 0:                #so at least it has an empty spot now check against filter and length
# #               removing reference to time_o. If there are no rvs there should be no times
# #                time_o = test_dataset.get_value('times', component=comp_o)
#                 passband_o = test_dataset.get_value('passband')
#
# #                if np.all(time_o == time) and (passband == passband_o):
#                 if (passband == passband_o):
#                     rv_dataset = test_dataset
#                     found = True
#
#         if not found:
#             try:
#                 eb._check_label(dataid)
#
#                 rv_dataset = eb.add_dataset('rv', dataset=dataid, times=[])
#
#             except ValueError:
#
#                 logger.warning("The name picked for the lightcurve is forbidden. Applying default name instead")
#                 rv_dataset = eb.add_dataset('rv', times=[])

    return rv_dataset
Since RV datasets can have values related to each component in phoebe2, but are component specific in phoebe1
    , it is important to determine which dataset to add parameters to. This function will do that.
    eb - bundle
    rvpt - relevant phoebe 1 parameters