def share_template_items(portal, item_ids, group_ids):
    func_results = {'success': True}
    errList = []
    for item_id in item_ids:
        results = portal.share_item(item_id, group_ids)
        if len(results['notSharedWith']) > 0:
            errList.append(results)
    
    if len(errList) > 0:
        func_results['success'] = False
        func_results['message'] = errList
        
    return func_results
dataset/ETHPy150Open Esri/ops-server-config/Publish/Portal/PortalContentPost.py/share_template_items/original