No regex parsing. Or at least, mostly, not regex.

def find_version_by_string_lib(
    line, version_token="__version__"
):  # type: (str,str)->Optional[str]
    """
    No regex parsing. Or at least, mostly, not regex.
    """
    if not line:
        return None
    simplified_line = simplify_line(line)
    version = None
    if simplified_line.strip().startswith(version_token):
        if '"' not in simplified_line:
            pass
            # logger.debug("Weird version string, no double quote : " + unicode((full_path, line, simplified_line)))
        else:
            if "=" in simplified_line:
                post_equals = simplified_line.split("=")[1]

                if post_equals.startswith('"'):
                    parts = post_equals.split('"')
                    version = parts[0]
                if not version:
                    version = None
    return version