code: def rename(path):
      
  
      new_path = prompt(path)
  
      if path != new_path:
          try:
              from shutil import move
          except ImportError:
              from os import rename as move
  
          move(path, new_path)
  
      return new_path
docs: Rename a file if necessary.