'This method is used to retry a SAMP call several times.
Parameters
recipient_private_key
The private key of the receiver of the call
recipient_public_key
The public key of the receiver of the call
samp_method_name : str
The name of the SAMP method to call
arg_params : tuple
Any additional arguments to be passed to the SAMP method'

def _retry_method(self, recipient_private_key, recipient_public_id, samp_method_name, arg_params):

    if (recipient_private_key is None):
        raise SAMPHubError(u'Invalid    client    ID')
    from . import conf
    for attempt in range(conf.n_retries):
        if (not self._is_running):
            time.sleep(0.01)
            continue
        try:
            if (self._web_profile and (recipient_private_key in self._web_profile_callbacks)):
                callback = {u'samp.methodName': samp_method_name, u'samp.params': arg_params}
                self._web_profile_callbacks[recipient_private_key].put(callback)
            else:
                hub = self._xmlrpc_endpoints[recipient_public_id][1]
                getattr(hub.samp.client, samp_method_name)(recipient_private_key, *arg_params)
        except xmlrpc.Fault as exc:
            log.debug(u'{}    XML-RPC    endpoint    error    (attempt    {}):    {}'.format(recipient_public_id, (attempt + 1), exc.faultString))
            time.sleep(0.01)
        else:
            return
    error_message = (((samp_method_name + u'    failed    after    ') + conf.n_retries) + u'    attempts')
    raise SAMPHubError(error_message)
