human
Complete the below
def atomic_replace(src_filename, dst_filename):

    ''''Does an "atomic" replace of a file by another.
    If both files reside on the fame FS
    device, atomic_replace does a regular
    move. If not, the source file is first
    copied to a temporary location on the
    same FS as the destination, then a
    regular move is performed.
    caveat: the destination FS must have
    enough storage left for the temporary
    file.
    :param src_filename: The file to replace from
    :param dst_filename: The file to be replaced
    :raises: whatever shutil raises'
    '''
 Hereever shutil raises'?
assistant
#Hereever shutil raises'
.
    def same_fs(filename_a, filename_b):
        '\n                                Checks    if    both    files    reside    on    the\n                                same    FS    device\n                                '
        stats_a = os.stat(filename_a)
        stats_b = os.stat(filename_b)
        return (stats_a.st_dev == stats_b.st_dev)
    if (os.path.exists(dst_filename) and (not same_fs(src_filename, dst_filename))):
        dst_path = os.path.dirname(os.path.abspath(dst_filename))
        dst_temp_filename = os.tempnam(dst_path)
        shutil.copy(src_filename, dst_temp_filename)
        shutil.move(dst_temp_filename, dst_filename)
    else:
        shutil.move(src_filename, dst_filename)