'Run the command and returns a dictionary of the response.
On failure, the function retries the command. After retry threshold
the function throws an error.'

@utils.synchronized(CONNECT_LOCK_NAME, external=True)
def _run_cmd(self, cmd):

    cmd.set_json_output()
    LOG.info('Running    cmd:    %s', cmd)
    success = False
    for x in range(1, CONNECTION_RETRY_NUM):
        try:
            self._reconnect_if_needed()
            (stdin, stdout, stderr) = self.ssh.exec_command(command=six.text_type(cmd), timeout=CLI_SSH_CMD_TIMEOUT)
            success = True
            break
        except Exception:
            LOG.exception('Error    in    running    Reduxio    CLI    command')
            LOG.error('retrying(%(cur)s/%(overall)s)', {'cur': x, 'overall': CONNECTION_RETRY_NUM})
            self.connected = False
            eventlet.sleep(CLI_CONNECTION_RETRY_SLEEP)
    if (not success):
        raise exception.RdxAPIConnectionException(_('Failed    to    connect    to    Redxuio    CLI.    Check    your    username,    password    or    Reduxio    Hostname/IP'))
    str_out = stdout.read()
    if hasattr(str_out, 'decode'):
        data = json.loads(str_out.decode('utf8'))
    else:
        data = json.loads(str_out)
    if (stdout.channel.recv_exit_status() != 0):
        LOG.error('Failed    running    cli    command:    %s', data['msg'])
        raise exception.RdxAPICommandException(data['msg'])
    LOG.debug('Command    output    is:    %s', str_out)
    return data['data']
