Return the cmd string to execute

def _cmd_str(self, cmd, ssh='ssh'):
        '''
        Return the cmd string to execute
        '''

        # TODO: if tty, then our SSH_SHIM cannot be supplied from STDIN Will
        # need to deliver the SHIM to the remote host and execute it there

        command = [ssh]
        if ssh != 'scp':
            command.append(self.host)
        if self.tty and ssh == 'ssh':
            command.append('-t -t')
        if self.passwd or self.priv:
            command.append(self.priv and self._key_opts() or self._passwd_opts())
        if ssh != 'scp' and self.remote_port_forwards:
            command.append(' '.join(['-R {0}'.format(item)
                                      for item in self.remote_port_forwards.split(',')]))
        if self.ssh_options:
            command.append(self._ssh_opts())

        command.append(cmd)

        return ' '.join(command)