read csv line

def read_line(csv_contents, options, prop_indices, mol, ensemble_list=None):
    """
	read csv line
	"""
    if not ensemble_list:
        score_field = options.score_field
    status_field = options.status_field
    active_label = options.active_label
    decoy_label = options.decoy_label

    # do the active/decoy labels have appropriate values?
    active_value_matcher = re.compile(active_label)
    decoy_value_matcher = re.compile(decoy_label)
    status_label_index = prop_indices[status_field]

    if not active_value_matcher.match(csv_contents[status_label_index]) and not decoy_value_matcher.match(
            csv_contents[status_label_index]):
        print("\n molecule lacks appropriate status label")
        return 1

    # are the score field values defined?
    score_field_indices = []
    if ensemble_list:
        queryList = ensemble_list
    else:
        queryList = [x for x in prop_indices.keys() if score_field in x]
    for query in queryList:
        score_field_indices.append(prop_indices[query])
    for value in [csv_contents[x] for x in score_field_indices]:
        if value in ('', 'n/a', 'N/A', None):
            print("\n molecule lacks appropriate score field value")
            return 1

    # loop over property values
    for label in prop_indices.keys():

        # get property value
        value_index = prop_indices[label]
        value = csv_contents[value_index]

        # set corresponding molecule attribute
        if label in queryList:
            mol.SetProp(label, value, 'score')
        else:
            mol.SetProp(label, value)

    # return mol
    return mol