def update_object(self, ref, payload, return_fields=None):
        """Update an Infoblox object

        Args:
            ref      (str): Infoblox object reference
            payload (dict): Payload with data to send
        Returns:
            The object reference of the updated object
        Raises:
            InfobloxException
        """
        query_params = self._build_query_params(return_fields=return_fields)

        opts = self._get_request_options(data=payload)
        url = self._construct_url(ref, query_params)
        self._log_request('put', url, opts)
        r = self.session.put(url, **opts)

        self._validate_authorized(r)

        if r.status_code != requests.codes.ok:
            self._check_service_availability('update', r, ref)

            raise ib_ex.InfobloxCannotUpdateObject(response=jsonutils.loads(
                r.content),
                                                   ref=ref,
                                                   content=r.content,
                                                   code=r.status_code)

        return self._parse_reply(r)
 def side_effect(ref, payload):
     raise exceptions.InfobloxCannotUpdateObject(
         **{
             'response': {
                 'result': 'fail'
             },
             'ref': ref,
             'content': 'hoge',
             'code': 400
         })