Recursively copy the contents of a source directory
    into a destination directory.
    Both directories must exist.

    This function does not copy the root directory ``source_directory``
    into ``destination_directory``.

    Since ``shutil.copytree(src, dst)`` requires ``dst`` not to exist,
    we cannot use for our purposes.

    Code adapted from http://stackoverflow.com/a/12686557

    :param string source_directory: the source directory, already existing
    :param string destination_directory: the destination directory, already existing

def copytree(source_directory, destination_directory, ignore=None):
    """
    Recursively copy the contents of a source directory
    into a destination directory.
    Both directories must exist.

    This function does not copy the root directory ``source_directory``
    into ``destination_directory``.

    Since ``shutil.copytree(src, dst)`` requires ``dst`` not to exist,
    we cannot use for our purposes.

    Code adapted from http://stackoverflow.com/a/12686557

    :param string source_directory: the source directory, already existing
    :param string destination_directory: the destination directory, already existing
    """
    if os.path.isdir(source_directory):
        if not os.path.isdir(destination_directory):
            os.makedirs(destination_directory)
        files = os.listdir(source_directory)
        if ignore is not None:
            ignored = ignore(source_directory, files)
        else:
            ignored = set()
        for f in files:
            if f not in ignored:
                copytree(
                    os.path.join(source_directory, f),
                    os.path.join(destination_directory, f),
                    ignore
                )
    else:
        shutil.copyfile(source_directory, destination_directory)