def best_version_match(vers_num, item_dict):
    'Attempts to find the best match in item_dict for vers_num'
    vers_tuple = vers_num.split('.')
    precision = 1
    while (precision <= len(vers_tuple)):
        test_vers = '.'.join(vers_tuple[0:precision])
        match_names = []
        for item in item_dict.keys():
            for item_version in item_dict[item]:
                if (item_version.startswith(test_vers) and (item not in match_names)):
                    match_names.append(item)
        if (len(match_names) == 1):
            return match_names[0]
        precision = (precision + 1)
    return None
Attempts to find the best match in item_dict for vers_num
def best_version_match(vers_num, item_dict):
    
    vers_tuple = vers_num.split('.')
    precision = 1
    while (precision <= len(vers_tuple)):
        test_vers = '.'.join(vers_tuple[0:precision])
        match_names = []
        for item in item_dict.keys():
            for item_version in item_dict[item]:
                if (item_version.startswith(test_vers) and (item not in match_names)):
                    match_names.append(item)
        if (len(match_names) == 1):
            return match_names[0]
        precision = (precision + 1)
    return None