import logging


def _loadCSV(filename):
    """Load and return the content of the given CSV file.

    :param str filename: The filename to read.
    :rtype: dict
    :returns: A dictionary mapping keys (first column) to values (second
        column).
    """

    csv = dict()
    try:
        with open(filename) as fh:
            for line in fh.readlines():
                if line.count(",") != 1:
                    logging.warning("Line must have exactly one comma: %s" %
                                    line)
                    continue
                key, value = line.split(",")
                csv[key.strip()] = value.strip()
    except IOError as err:
        logging.warning("I/O error while reading from file %s: %s" %
                        (filename, err))

    return csv