def check_or_raise_extra(value, message):
    if (type(value) != dict):
        raise ProtocolError('{0}: invalid type {1}'.format(message, type(value)))
    for k in value.keys():
        if (type(k) != six.text_type):
            raise ProtocolError("{0}: invalid type {1} for key '{2}'".format(message, type(k), k))
    return value
def check_or_raise_extra(value, message):
    if (type(value) != dict):
        raise ProtocolError('{0}: invalid type {1}'.format(message, type(value)))
    for k in value.keys():
        if (type(k) != six.text_type):
            raise ProtocolError("{0}: invalid type {1} for key '{2}'".format(message, type(k), k))
    return value