def get_version_string(init_file):
    """
    Read __version__ string for an init file.
    """

    with open(init_file, "r") as fp:
        content = fp.read()
        version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", content, re.M)
        if version_match:
            return version_match.group(1)

        raise RuntimeError("Unable to find version string in %s." % (init_file))

    Read __version__ string for an init file.
    
contrib/runners/inquirer_runner/dist_utils.py