def transfer_item_sharing(portal, src_item_id, target_item_id):
    everyone = False
    org = False
    
    src_item_props, src_item_sharing, src_folder_id = portal.user_item(
                                    src_item_id,
                                    portal.item(src_item_id)['owner'])

    if src_item_sharing['access'].lower() == 'public':
         everyone = True
         org = True
    elif src_item_sharing['access'].lower() == 'org':
         everyone = False
         org = True
     
    resp = portal.share_item(target_item_id,
                             src_item_sharing.get('groups'),
                             org,
                             everyone)
            
    return resp
Transfer item sharing information from source item to target item
dataset/ETHPy150Open Esri/ops-server-config/Publish/Portal/PublishHostedServices.py/transfer_item_sharing