code: def with_name(self, name):
          
          if not self.name:
              raise ValueError("%r has an empty name" % (self,))
          drv, root, parts = self._flavour.parse_parts((name,))
          if (not name or name[-1] in [self._flavour.sep, self._flavour.altsep]
                  or drv or root or len(parts) != 1):
              raise ValueError("Invalid name %r" % (name))
          return self._from_parsed_parts(self._drv, self._root,
                                         self._parts[:-1] + [name])
docs: Return a new path with the file name changed.