Regex for dunder version

def find_version_by_regex(
    file_source, version_token="__version__"
):  # type: (str,str)->Optional[str]
    """
    Regex for dunder version
    """
    if not file_source:
        return None
    version_match = re.search(
        r"^" + version_token + r" = ['\"]([^'\"]*)['\"]", file_source, re.M
    )
    if version_match:
        candidate = version_match.group(1)
        if candidate == "" or candidate == ".":  # yes, it will match to a .
            return None
        return candidate
    return None