:param data: response json data object (must be not None).
    Check possible error code returned in the response body
    raise the coresponding exceptions

def _check_err(data):
    """
    :param data: response json data object (must be not None).
    Check possible error code returned in the response body
    raise the coresponding exceptions
    """
    if data['d'] is None:
        raise NoDataReturned()
    if data['d']['Messages'] is None:
        return

    msg = data['d']['Messages']
    if len(msg) == 0 or msg[0]['Code'] is None:
        raise UnknownError()

    code = int(msg[0]['Code'])
    if code == 3006:
        raise CalendarNotExist()
    elif code == 3007:
        raise CalendarOwnByDiffAccount()
    else:
        logger.warn(
            "Unexpected Error Code: %s %s" % (
                code, msg[0]['Description']))
        raise UnexpectedError()