'Helper function used for prepare clone and delete REST calls.'

def _help_call_method(self, args, retry_count):

    remaining = retry_count
    resp = self._send_cmd(args['method'], args['url'], args['arglist'])
    status = resp['status']
    if (status == 400):
        reason = ''
        if ('content' in resp):
            reason = etree.fromstring(resp['content'])
            if (reason is not None):
                reason = reason.text.upper()
        if (INVALID_STATUS in reason):
            LOG.debug('REST    call    failed    with    invalid    state:    %(method)s    -    %(status)d    -    %(reason)s', {'method': args['method'], 'status': status, 'reason': reason})
            remaining -= 1
        else:
            remaining = 0
    else:
        remaining = 0
    return (remaining, resp)
