def rename_file(old, new):
 if os.path.isfile(old):
  if file_exists(new):
   raise NinjaFileExistsException(new)
  os.rename(old, new)
  return new
 return u''

def rename_file ( old , new ) : if os . path . isfile ( old ) : if file_exists ( new ) : raise NinjaFileExistsException ( new ) os . rename ( old , new ) return new return u''
rename a file .