def _get_results(csv_reader, fieldnames):
    """Maps data to fieldnames.

    The reader needs to be at position after fieldnames, before the results data.
    """
    fieldnames_count = len(fieldnames)
    results = []
    for row in csv_reader:
        for col in row:
            if col:
                break
        else:
            # empty row, skip it
            continue
        record = OrderedDict(list(zip(fieldnames, row)))
        # skip rows that were already exported
        if record.get("exported") == "yes":
            continue
        row_len = len(row)
        if fieldnames_count > row_len:
            for key in fieldnames[row_len:]:
                record[key] = None
        results.append(record)

    return results
Maps data to fieldnames.

    The reader needs to be at position after fieldnames, before the results data.