<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def delocate_wheel(in_wheel, out_wheel = None, lib_sdir = '.dylibs', lib_filt_func = None, copy_filt_func = filter_system_libs, require_archs = None, check_verbose = False, ):
 """ Update wheel by copying required libraries to `lib_sdir` in wheel Create `lib_sdir` in wheel tree only if we are copying one or more libraries. If `out_wheel` is None (the default), overwrite the wheel `in_wheel` in-place. Parameters in_wheel : str Filename of wheel to process out_wheel : None or str Filename of processed wheel to write. If None, overwrite `in_wheel` lib_sdir : str, optional Subdirectory name in wheel package directory (or directories) to store needed libraries. lib_filt_func : None or str or callable, optional If None, inspect all files for dependencies on dynamic libraries. If callable, accepts filename as argument, returns True if we should inspect the file, False otherwise. If str == "dylibs-only" then inspect only files with known dynamic library extensions (``.dylib``, ``.so``). copy_filt_func : None or callable, optional If callable, called on each library name detected as a dependency; copy where ``copy_filt_func(libname)`` is True, don't copy otherwise. Default is callable rejecting only libraries beginning with ``/usr/lib`` or ``/System``. None means copy all libraries. This will usually end up copying large parts of the system run-time. require_archs : None or str or sequence, optional If None, do no checks of architectures in libraries. If sequence, sequence of architectures (output from ``lipo -info``) that every library in the wheels should have (e.g. ``['x86_64, 'i386']``). An empty sequence results in checks that depended libraries have the same archs as depending libraries. If string, either "intel" (corresponds to sequence ``['x86_64, 'i386']``) or name of required architecture (e.g "i386" or "x86_64"). check_verbose : bool, optional If True, print warning messages about missing required architectures Returns ------- copied_libs : dict dict containing the (key, value) pairs of (``copied_lib_path``, ``dependings_dict``), where ``copied_lib_path`` is a library real path that was copied into `lib_sdir` of the wheel packages, and ``dependings_dict`` is a dictionary with key, value pairs where the key is a path in the wheel depending on ``copied_lib_path``, and the value is the ``install_name`` of ``copied_lib_path`` in the depending library. The filenames in the keys are relative to the wheel root path. """

    if lib_filt_func == "dylibs-only":
        lib_filt_func = _dylibs_only
    in_wheel = abspath(in_wheel)
    if out_wheel is None:
        out_wheel = in_wheel
    else:
        out_wheel = abspath(out_wheel)
    in_place = in_wheel == out_wheel
    with TemporaryDirectory() as tmpdir:
        all_copied = {}
        wheel_dir = realpath(pjoin(tmpdir, 'wheel'))
        zip2dir(in_wheel, wheel_dir)
        for package_path in find_package_dirs(wheel_dir):
            lib_path = pjoin(package_path, lib_sdir)
            lib_path_exists = exists(lib_path)
            copied_libs = delocate_path(package_path, lib_path,
                                        lib_filt_func, copy_filt_func)
            if copied_libs and lib_path_exists:
                raise DelocationError(
                    '{0} already exists in wheel but need to copy '
                    '{1}'.format(lib_path, '; '.join(copied_libs)))
            if len(os.listdir(lib_path)) == 0:
                shutil.rmtree(lib_path)
            # Check architectures
            if not require_archs is None:
                stop_fast = not check_verbose
                bads = check_archs(copied_libs, require_archs, stop_fast)
                if len(bads) != 0:
                    if check_verbose:
                        print(bads_report(bads, pjoin(tmpdir, 'wheel')))
                    raise DelocationError(
                        "Some missing architectures in wheel")
            # Change install ids to be unique within Python space
            install_id_root = (DLC_PREFIX +
                               relpath(package_path, wheel_dir) +
                               '/')
            for lib in copied_libs:
                lib_base = basename(lib)
                copied_path = pjoin(lib_path, lib_base)
                set_install_id(copied_path, install_id_root + lib_base)
                validate_signature(copied_path)
            _merge_lib_dict(all_copied, copied_libs)
        if len(all_copied):
            rewrite_record(wheel_dir)
        if len(all_copied) or not in_place:
            dir2zip(wheel_dir, out_wheel)
    return stripped_lib_dict(all_copied, wheel_dir + os.path.sep)