human
Complete this python program:
def dnd_get_files(md, exts, allow_all_extensions=False, filter_exts=()):
assistant
#Here is the Python code you requested.

    """Get the file in the QMimeData object md with an extension that is one of
    the extensions in exts.
    :return: None, None if no file is found
    [paths], None if a local file is found
    [urls], [filenames] if URLs that point to a files are found
    """
    urls = urls_from_md(md)
    local_files = [path_from_qurl(x) for x in urls]
    def is_ok(path):
        ext = posixpath.splitext(path)[1][1:].lower()
        if (allow_all_extensions and ext and (ext not in filter_exts)):
            return True
        return ((ext in exts) and (ext not in filter_exts))
    local_files = [p for p in local_files if is_ok(urllib.unquote(p))]
    local_files = [x for x in local_files if os.path.exists(x)]
    if local_files:
        return (local_files, None)
    (rurl, fname) = get_firefox_rurl(md, exts)
    if (rurl and fname):
        return ([rurl], [fname])
    (rurls, filenames) = ([], [])
    for (rurl, fname) in remote_urls_from_qurl(urls, exts):
        (rurls.append(rurl), filenames.append(fname))
    if rurls:
        return (rurls, filenames)
    return (None, None)