human
Complete this python program:
def _TestQueryUsers(tester, user_cookie, request_dict):
assistant
#Here is the Python code you requested.

    """Called by the ServiceTester in order to test query_users
    service API call.
    """
    validator = tester.validator
    (user_id, device_id) = tester.GetIdsFromCookie(user_cookie)
    def _MakeMetadataDict(friend_user, forward_friend, reverse_friend):
        user_dict = {'user_id': friend_user.user_id}
        labels = list(friend_user.labels.intersection([User.REGISTERED, User.TERMINATED]))
        if (reverse_friend is not None):
            util.SetIfNotNone(user_dict, 'name', friend_user.name)
            util.SetIfNotNone(user_dict, 'given_name', friend_user.given_name)
            util.SetIfNotNone(user_dict, 'family_name', friend_user.family_name)
            util.SetIfNotNone(user_dict, 'email', friend_user.email)
            util.SetIfNotNone(user_dict, 'picture', friend_user.picture)
            util.SetIfNotNone(user_dict, 'merged_with', friend_user.merged_with)
            labels.append('friend')
        user_dict['labels'] = labels
        if (friend_user.user_id == user_id):
            user_dict['private'] = {'subscriptions': [], 'user_identities': []}
            if (friend_user.pwd_hash is None):
                user_dict['private']['no_password'] = True
            db_key = DBKey(('us:%d' % user_id), AccountSettings.GROUP_NAME)
            settings = validator.GetModelObject(AccountSettings, db_key, must_exist=False)
            if (settings is not None):
                settings_dict = user_dict['private'].setdefault('account_settings', {})
                util.SetIfNotNone(settings_dict, 'email_alerts', settings.email_alerts)
                util.SetIfNotNone(settings_dict, 'sms_alerts', settings.sms_alerts)
                util.SetIfNotEmpty(settings_dict, 'storage_options', list(settings.storage_options))
            predicate = (lambda ident: (ident.user_id == user_id))
            for expected_ident in validator.QueryModelObjects(Identity, predicate=predicate):
                ident_dict = {'identity': expected_ident.key}
                if (expected_ident.authority is not None):
                    ident_dict['authority'] = expected_ident.authority
               ...