def find_assign(data, varname):
    """Finds a substring that looks like an assignment.

    :param data: Source to search in.
    :param varname: Name of the variable for which an assignment should be
                    found.
    """
    ASSIGN_RE = re.compile(BASE_ASSIGN_PATTERN.format(varname))

    if len(ASSIGN_RE.findall(data)) > 1:
        raise PluginError('Found multiple {}-strings.'.format(varname))

    if len(ASSIGN_RE.findall(data)) < 1:
        raise PluginError('No version assignment ("{}") found.'
                          .format(varname))

    return ASSIGN_RE.search(data).group(2)
Finds a substring that looks like an assignment.

    :param data: Source to search in.
    :param varname: Name of the variable for which an assignment should be
                    found.