def filter_osversion(osurl, device, filterdict):
    """
    Modify URLs based on device index and dictionary of changes.

    :param osurl: OS URL to modify.
    :type osurl: str

    :param device: Device to use.
    :type device: int

    :param filterdict: Dictionary of changes: {device : (before, after)}
    :type filterdict: dict(int:(str, str))
    """
    if device in filterdict.keys():
        osurl = osurl.replace(filterdict[device][0], filterdict[device][1])
    return osurl