'run a command on the remote host'

def exec_command(self, cmd, in_data=None, sudoable=True):

    super(Connection, self).exec_command(cmd, in_data=in_data, sudoable=sudoable)
    if in_data:
        raise AnsibleError('Internal    Error:    this    module    does    not    support    optimized    module    pipelining')
    display.vvv(('EXEC    COMMAND    %s' % cmd), host=self._play_context.remote_addr)
    data = dict(mode='command', cmd=cmd, executable=C.DEFAULT_EXECUTABLE)
    data = jsonify(data)
    data = keyczar_encrypt(self.key, data)
    if self.send_data(data):
        raise AnsibleError(('Failed    to    send    command    to    %s' % self._play_context.remote_addr))
    while True:
        response = self.recv_data()
        if (not response):
            raise AnsibleError(('Failed    to    get    a    response    from    %s' % self._play_context.remote_addr))
        response = keyczar_decrypt(self.key, response)
        response = json.loads(response)
        if ('pong' in response):
            display.vvvv('received    a    keepalive    packet', host=self._play_context.remote_addr)
            continue
        else:
            display.vvvv('received    the    response', host=self._play_context.remote_addr)
            break
    return (response.get('rc', None), response.get('stdout', ''), response.get('stderr', ''))
