human
Complete this python program:
def WriteCopies(target_name, copies, extra_deps, path_to_gyp, output):
assistant
#Here is the Python code you requested.

    """Write CMake for the \copies\ in the target.
    Args:
    target_name: the name of the CMake target being generated.
    actions: the Gyp \actions\ dict for this target.
    extra_deps: [<cmake_taget>] to append with generated targets.
    path_to_gyp: relative path from CMakeLists.txt being generated to
    the Gyp file in which the target being generated is defined.
    """
    copy_name = (target_name + '__copies')
    have_copies = any((copy['files'] for copy in copies))
    if (not have_copies):
        output.write('add_custom_target(')
        output.write(copy_name)
        output.write(')\n')
        extra_deps.append(copy_name)
        return
    class Copy(object, ):
        def __init__(self, ext, command):
            self.cmake_inputs = []
            self.cmake_outputs = []
            self.gyp_inputs = []
            self.gyp_outputs = []
            self.ext = ext
            self.inputs_name = None
            self.outputs_name = None
            self.command = command
    file_copy = Copy('', 'copy')
    dir_copy = Copy('_dirs', 'copy_directory')
    for copy in copies:
        files = copy['files']
        destination = copy['destination']
        for src in files:
            path = os.path.normpath(src)
            basename = os.path.split(path)[1]
            dst = os.path.join(destination, basename)
            copy = (file_copy if os.path.basename(src) else dir_copy)
            copy.cmake_inputs.append(NormjoinPathForceCMakeSource(path_to_gyp, src))
            copy.cmake_outputs.append(NormjoinPathForceCMakeSource(path_to_gyp, dst))
            copy.gyp_inputs.append(src)
            copy.gyp_outputs.append(dst)
    for copy in (file_copy, dir_copy):
        if copy.cmake_inputs:
            copy.inputs_name = ((copy_name + '__input') + copy.ext)
            SetVariableList(output, copy.inputs_name, copy.cmake_inputs)
            copy.outputs_name = ((copy_name + '__output') + copy.ext)
            SetVariableList(output, copy.outputs_name, copy.cmake_outputs)
    output.write('add_custom_command(\n')
    output.write('OUTPUT')
    for copy in (file_copy, dir_copy):
        if copy.outputs_name:
            WriteVariable(output, copy.outputs_name, '    ')
    output.write('\n')
    for copy in (file_copy, dir_copy):
        for (src, dst) in zip(copy.gyp_inputs, copy.gyp_outputs):
            output.write(('COMMAND    ${CMAKE_COMMAND}    -E    %s    ' %...