<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getmtime(self, filepath):
 """Gets the last time that the file was modified."""

        if self.is_ssh(filepath):
            self._check_ftp()
            source = self._get_remote(filepath)
            mtime = self.ftp.stat(source).st_mtime
        else:
            mtime = os.path.getmtime(filepath)

        return mtime