<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def walk(self, dirpath):
 """Performs an os.walk on a local or SSH filepath."""

        if self.is_ssh(dirpath):
            self._check_ftp()
            remotepath = self._get_remote(dirpath)
            return self._sftp_walk(remotepath)
        else:
            return os.walk(dirpath)