<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def extend_by(self, extension):
 """The path to the file changed to use the given extension <FilePath '/path/to/fred.txt'> <FilePath '/path/to/fred.tmp'> <FilePath '/path/to/fred.fred'> """

        copy = self[:]
        filename, _ = os.path.splitext(copy)
        return self.__class__('%s.%s' % (filename, extension.lstrip('.')))