def is_rel_one(val, relname):
    """
    # 1. null relation
    rv=val.getRelatedOne('InventoryItemType', False)
    print(is_rel_one(val, 'InventoryItemType'), rv)

    # 2. multiple relations
    rv=val.getRelated('ProductKeyword', None, None, False)
    print(is_rel_one(val, 'ProductKeyword'))
    print(json.dumps(to_json_list(rv), indent=2))

    :param val:
    :param relname:
    :return:
    """
    relation = val.getModelEntity().getRelation(relname)
    reltype = relation.getType()
    return reltype == 'one' or reltype == 'one-nofk'
