def _parse_job_state(self, xml):
    tree = ET.fromstring(xml)
    completed = 0
    pending = 0
    failed = 0
    for el in tree.iterfind(('.//{%s}state' % self.bulk.jobNS)):
        state = el.text
        if (state == 'Not Processed'):
            return 'Aborted'
        elif (state == 'Failed'):
            failed += 1
        elif (state == 'Completed'):
            completed += 1
        else:
            pending += 1
    if pending:
        return 'InProgress'
    elif failed:
        return 'Failed'
    else:
        return 'Completed'
def _parse_job_state(self, xml):
    tree = ET.fromstring(xml)
    completed = 0
    pending = 0
    failed = 0
    for el in tree.iterfind(('.//{%s}state' % self.bulk.jobNS)):
        state = el.text
        if (state == 'Not Processed'):
            return 'Aborted'
        elif (state == 'Failed'):
            failed += 1
        elif (state == 'Completed'):
            completed += 1
        else:
            pending += 1
    if pending:
        return 'InProgress'
    elif failed:
        return 'Failed'
    else:
        return 'Completed'