human
Complete this python program:
def find_programs(curdir):
assistant
#Here is the Python program you requested.

    """Find external programs
    """
    def check(path, program):
        p = os.path.abspath(os.path.join(path, program))
        if os.access(p, os.X_OK):
            return p
        else:
            return None
    if sabnzbd.DARWIN:
        sabnzbd.newsunpack.PAR2_COMMAND = check(curdir, 'osx/par2/par2-sl64')
        sabnzbd.newsunpack.RAR_COMMAND = check(curdir, 'osx/unrar/unrar')
        sabnzbd.newsunpack.SEVEN_COMMAND = check(curdir, 'osx/7zip/7za')
    if sabnzbd.WIN32:
        if sabnzbd.WIN64:
            sabnzbd.newsunpack.MULTIPAR_COMMAND = check(curdir, 'win/par2/multipar/par2j64.exe')
            sabnzbd.newsunpack.RAR_COMMAND = check(curdir, 'win/unrar/x64/UnRAR.exe')
        else:
            sabnzbd.newsunpack.MULTIPAR_COMMAND = check(curdir, 'win/par2/multipar/par2j.exe')
            sabnzbd.newsunpack.RAR_COMMAND = check(curdir, 'win/unrar/UnRAR.exe')
        sabnzbd.newsunpack.PAR2_COMMAND = check(curdir, 'win/par2/par2.exe')
        sabnzbd.newsunpack.ZIP_COMMAND = check(curdir, 'win/unzip/unzip.exe')
        sabnzbd.newsunpack.SEVEN_COMMAND = check(curdir, 'win/7zip/7za.exe')
    else:
        if (not sabnzbd.newsunpack.PAR2_COMMAND):
            sabnzbd.newsunpack.PAR2_COMMAND = find_on_path('par2')
        if (not sabnzbd.newsunpack.RAR_COMMAND):
            sabnzbd.newsunpack.RAR_COMMAND = find_on_path(('unrar', 'rar', 'unrar3', 'rar3'))
        sabnzbd.newsunpack.NICE_COMMAND = find_on_path('nice')
        sabnzbd.newsunpack.IONICE_COMMAND = find_on_path('ionice')
        if (not sabnzbd.newsunpack.ZIP_COMMAND):
            sabnzbd.newsunpack.ZIP_COMMAND = find_on_path('unzip')
        if (not sabnzbd.newsunpack.SEVEN_COMMAND):
            sabnzbd.newsunpack.SEVEN_COMMAND = find_on_path('7za')
        if (not sabnzbd.newsunpack.SEVEN_COMMAND):
            sabnzbd.newsunpack.SEVEN_COMMAND = find_on_path('7z')
    if (not (sabnzbd.WIN32 or sabnzbd.DARWIN)):
        (version, original) = unrar_check(sabnzbd.newsunpack.RAR_COMMAND)
        sabnzbd.newsunpack.RAR_PROBLEM = ((not original) or (version <...