Reads the content of the Polarion exported csv file and returns imported data.

def get_imported_data(csv_file, **kwargs):
    """Reads the content of the Polarion exported csv file and returns imported data."""
    open_args = []
    open_kwargs = {}
    try:
        # pylint: disable=pointless-statement
        unicode
        open_args.append("rb")
    except NameError:
        open_kwargs["encoding"] = "utf-8"
    with open(os.path.expanduser(csv_file), *open_args, **open_kwargs) as input_file:
        reader = _get_csv_reader(input_file)

        fieldnames = _get_csv_fieldnames(reader)
        if not fieldnames:
            raise Dump2PolarionException(
                "Cannot find field names in CSV file '{}'".format(csv_file)
            )

        results = _get_results(reader, fieldnames)
        if not results:
            raise Dump2PolarionException("No results read from CSV file '{}'".format(csv_file))

        testrun = _get_testrun_from_csv(input_file, reader)

    return xunit_exporter.ImportedData(results=results, testrun=testrun)