'create a modified version of this path.
the following keyword arguments modify various path parts::
a:/some/path/to/a/file.ext
xx                           drive
xxxxxxxxxxxxxxxxx            dirname
xxxxxxxx   basename
xxxx       purebasename
xxx   ext'

def new(self, **kw):

    obj = object.__new__(self.__class__)
    if (not kw):
        obj.strpath = self.strpath
        return obj
    (drive, dirname, basename, purebasename, ext) = self._getbyspec('drive,dirname,basename,purebasename,ext')
    if ('basename' in kw):
        if (('purebasename' in kw) or ('ext' in kw)):
            raise ValueError(('invalid    specification    %r' % kw))
    else:
        pb = kw.setdefault('purebasename', purebasename)
        try:
            ext = kw['ext']
        except KeyError:
            pass
        else:
            if (ext and (not ext.startswith('.'))):
                ext = ('.' + ext)
        kw['basename'] = (pb + ext)
    if (('dirname' in kw) and (not kw['dirname'])):
        kw['dirname'] = drive
    else:
        kw.setdefault('dirname', dirname)
    kw.setdefault('sep', self.sep)
    obj.strpath = normpath(('%(dirname)s%(sep)s%(basename)s' % kw))
    return obj
