'Return a list of valid profile or system objects selected from all profiles
or systems by name, or everything if selected_items is empty'

def filter_systems_or_profiles(self, selected_items, list_type):

    if (list_type == 'profile'):
        all_objs = [profile for profile in self.api.profiles()]
    elif (list_type == 'system'):
        all_objs = [system for system in self.api.systems()]
    else:
        utils.die(self.logger, ('Invalid    list_type    argument:    ' + list_type))
    all_objs.sort(self.sort_name)
    if (not selected_items):
        return all_objs
    which_objs = []
    selected_list = utils.input_string_or_list(selected_items)
    for obj in all_objs:
        if (obj.name in selected_list):
            which_objs.append(obj)
    if (not which_objs):
        utils.die(self.logger, 'No    valid    systems    or    profiles    were    specified.')
    return which_objs
