def METHOD_NAME(user_ids):
    results = (
        UserES()
        .user_ids(user_ids)
        .fields(['_id', '__group_ids', '__group_names'])
        .scroll()
    )
    for result in results:
        group_ids = result.get('__group_ids', [])
        group_ids = set(group_ids) if isinstance(group_ids, list) else {group_ids}
        group_names = result.get('__group_names', [])
        group_names = set(group_names) if isinstance(group_names, list) else {group_names}
        yield UserSource(result['_id'], group_ids, group_names)