def _parse_spark_conf(path):
    """
    Parses the file found at the given path and returns a dict of spark conf.

    All values in the dict will be strings, regardless of the presence of quotations in the file; double quotes are
    stripped from values.  The '#' marks the beginning of a comment, which will be ignored, whether as a line, or
    the tail end of a line.

    Parameters
    ----------

    :param path: file path
    :return: (dict) spark conf

    Example
    -------

    Suppose Spark conf file 'my.conf':

        spark.driver.cores=1
        spark.driver.memory="1664m"
        spark.executor.cores=2

    Then,

        >>> _parse_spark_conf('my.conf')
        {'spark.driver.cores': '1', 'spark.driver.memory': '1664m', 'spark.executor.cores': '2'}

    """
    conf = {}
    with open(path, 'r') as r:
        for line in r.readlines():
            comment_start_index = line.find('#')
            text = line if comment_start_index < 0 else line[:comment_start_index]
            if text.strip():
                try:
                    k, v = text.split('=', 1)
                except ValueError:
                    raise RuntimeError("spark conf file %s has a bad line; may be missing an '=': %s" % (path, line))
                conf[k.strip()] = v.strip().strip('"')
    return conf