'Copy the format ``fmt`` to the file like object ``dest``. If the
specified format does not exist, raises :class:`NoSuchFormat` error.
dest can also be a path, in which case the format is copied to it, iff
the path is different from the current path (taking case sensitivity
into account).
If use_hardlink is True, a hard link will be created instead of the
file being copied. Use with care, because a hard link means that
modifying any one file will cause both files to be modified.
windows_atomic_move is an internally used parameter. You should not use
it in any code outside this module.'

def copy_format_to(self, index, fmt, dest, index_is_id=False, windows_atomic_move=None, use_hardlink=False):

    path = self.format_abspath(index, fmt, index_is_id=index_is_id)
    if (path is None):
        id_ = (index if index_is_id else self.id(index))
        raise NoSuchFormat(('Record    %d    has    no    %s    file' % (id_, fmt)))
    if (windows_atomic_move is not None):
        if (not isinstance(dest, basestring)):
            raise Exception('Error,    you    must    pass    the    dest    as    a    path    when    using    windows_atomic_move')
        if dest:
            if samefile(path, dest):
                try:
                    if (path != dest):
                        os.rename(path, dest)
                except:
                    pass
            else:
                windows_atomic_move.copy_path_to(path, dest)
    elif hasattr(dest, 'write'):
        with lopen(path, 'rb') as f:
            shutil.copyfileobj(f, dest)
        if hasattr(dest, 'flush'):
            dest.flush()
    elif dest:
        if samefile(dest, path):
            if ((not self.is_case_sensitive) and (path != dest)):
                try:
                    os.rename(path, dest)
                except:
                    pass
        else:
            if use_hardlink:
                try:
                    hardlink_file(path, dest)
                    return
                except:
                    pass
            with lopen(path, 'rb') as f:
                with lopen(dest, 'wb') as d:
                    shutil.copyfileobj(f, d)
