import re


def get_version(versionfile):
    """Extract the __version__ from a given Python module."""
    match = re.search(r'^__version__ = [\'"]([^\'"]*)[\'"]', open(versionfile).read(), re.M)
    if match:
        return match.group(1)
    else:
        raise RuntimeError("Unable to find version string in {file}.".format(file=versionfile))