human
Complete this python program:
def __scan_code_instruction_for_ctypes(co, instructions):
assistant
#Here is the Python code you requested.

    """Detects ctypes dependencies, using reasonable heuristics that
    should cover most common ctypes usages; returns a tuple of two
    lists, one containing names of binaries detected as
    dependencies, the other containing warnings.
    """
    def _libFromConst():
        'Extracts    library    name    from    an    expected    LOAD_CONST    instruction    and\n                                appends    it    to    local    binaries    list.\n                                '
        instruction = next(instructions)
        if (instruction.opname == 'LOAD_CONST'):
            soname = co.co_consts[instruction.arg]
            if isinstance(soname, str):
                return soname
    instruction = next(instructions)
    expected_ops = ('LOAD_GLOBAL', 'LOAD_NAME')
    if (instruction.opname not in expected_ops):
        return None
    name = co.co_names[instruction.arg]
    if (name == 'ctypes'):
        expected_ops = ('LOAD_ATTR',)
        instruction = next(instructions)
        if (instruction.opname not in expected_ops):
            return None
        name = co.co_names[instruction.arg]
    if (name in ('CDLL', 'WinDLL', 'OleDLL', 'PyDLL')):
        return _libFromConst()
    elif (name in ('cdll', 'windll', 'oledll', 'pydll')):
        instruction = next(instructions)
        if (instruction.opname == 'LOAD_ATTR'):
            if (co.co_names[instruction.arg] == 'LoadLibrary'):
                return _libFromConst()
            else:
                return (co.co_names[instruction.arg] + '.dll')
    elif ((instruction.opname == 'LOAD_ATTR') and (name in ('util',))):
        instruction = next(instructions)
        if (instruction.opname == 'LOAD_ATTR'):
            if (co.co_names[instruction.arg] == 'find_library'):
                libname = _libFromConst()
                if libname:
                    lib = ctypes.util.find_library(libname)
                    if lib:
                        return os.path.basename(lib)