def gather_new_users(user_profile: UserProfile, threshold: datetime.datetime) -> Tuple[int, List[str]]: # Gather information on users in the realm who have recently # joined. if not user_profile.can_access_all_realm_members(): new_users = [] # type: List[UserProfile] else: new_users = list(UserProfile.objects.filter( realm=user_profile.realm, date_joined__gt=threshold, is_bot=False)) user_names = [user.full_name for user in new_users] return len(user_names), user_names