download files with wget

def wget(ftp, f = False, exclude = False, name = False, md5 = False, tries = 10):
    """
    download files with wget
    """
    # file name
    if f is False:
        f = ftp.rsplit('/', 1)[-1]
    # downloaded file if it does not already exist
    # check md5s on server (optional)
    t = 0
    while md5check(f, ftp, md5, exclude) is not True:
        t += 1
        if name is not False:
            print('# downloading:', name, f)
        if exclude is False:
            command = 'wget -q --random-wait %s' % (ftp)
        else:
            command = 'wget -q --random-wait -R %s %s' % (exclude, ftp)
        p = Popen(command, shell = True)
        p.communicate()
        if t >= tries:
            print('not downloaded:', name, f)
            return [f, False]
    return [f, True]