Copies files from the template into their target location. Unicode files
    get their variables replaced here and files with a shebang are set to be
    executable.

def copy_files(project_vars, project_dir, files):
    """
    Copies files from the template into their target location. Unicode files
    get their variables replaced here and files with a shebang are set to be
    executable.
    """

    for root, name, content, is_unicode in files:
        project_name = project_vars['project_name_snake']

        if is_unicode:
            content = replace_content(content, project_vars)

        file_path = make_file_path(project_dir, project_name, root, name)
        makedirs(make_dir_path(project_dir, root, project_name), exist_ok=True)

        if is_unicode:
            with open(file_path, 'w') as f:
                f.write(content)

            if content.startswith('#!'):
                chmod(file_path, 0o755)
        else:
            with open(file_path, 'wb') as f:
                f.write(content)