Unholy, forward-compatible, mess for extraction of id/oid from a
        soon-to-be (deprecated) batch response.

def _extract_id_from_batch_response(r, name='id'):
        """Unholy, forward-compatible, mess for extraction of id/oid from a
        soon-to-be (deprecated) batch response."""
        names = name + 's'
        if names in r:
            # soon-to-be deprecated batch reponse
            if 'errors' in r and r['errors']:
                raise GeneralException(r['errors'][0]['desc'])
            id = r[names][0]
        else:
            # new-style simplified api response
            id = r[name]
        return int(id)