def exec_command(self, command, sudo=False, **kwargs):
channel = self.client.get_transport().open_session()<EOL>stdout = channel.makefile('<STR_LIT:rb>')<EOL>stderr = channel.makefile_stderr('<STR_LIT:rb>')<EOL>if sudo:<EOL><INDENT>command = '<STR_LIT>' % command<EOL><DEDENT>else:<EOL><INDENT>command = '<STR_LIT>' % command<EOL><DEDENT>logger.debug("<STR_LIT>", command, self.host)<EOL>channel.exec_command(command, **kwargs)<EOL>while not (channel.recv_ready() or channel.closed or<EOL>channel.exit_status_ready()):<EOL><INDENT>time.sleep(<NUM_LIT>)<EOL><DEDENT>ret = {'<STR_LIT>': stdout.read().strip(), '<STR_LIT>': stderr.read().strip(),<EOL>'<STR_LIT>': channel.recv_exit_status()}<EOL>return ret<EOL>
Wrapper to paramiko.SSHClient.exec_command