code: def rename(from_path, to_path, user=None):
      
      fhost, fport, fpath = path.split(from_path, user)
      thost, tport, tpath = path.split(to_path, user)
      with hdfs(thost, tport, user) as fs:
          chost, cport = fs.host, fs.port
      with hdfs(fhost, fport, user) as fs:
          if fs.host != chost or fs.port != cport:
              raise RuntimeError("can't do a cross-fs rename")
          return fs.rename(fpath, tpath)
docs: See :meth:`fs.hdfs.rename`.