'Helper for parsing VPSA\'s XML output.
Returns single item if first==True or list for multiple selection.
If second argument in search_tuple is None - returns all items with
appropriate key.'

def _xml_parse_helper(self, xml_tree, first_level, search_tuple, first=True):

    objects = xml_tree.find(first_level)
    if (objects is None):
        return None
    result_list = []
    (key, value) = search_tuple
    for object in objects.getchildren():
        found_value = object.findtext(key)
        if (found_value and ((found_value == value) or (value is None))):
            if first:
                return object
            else:
                result_list.append(object)
    return (result_list if result_list else None)
