import datetime 

def birthBeforeDeath(IndList,wr):
    flag = False
    wr.write("\n\nUS03 - Birth before death\n")
    for date in (IndList):
        if date[4][10:] == "Alive":
            pass
        else:
            if date[1][:4] == "NAME":
                name = date[1][5:]
                #print name
            date1 = date[3][10:].strip()
            birt_date = datetime.datetime.strptime(date1,'%Y-%m-%d').date()
            date2 = date[4][10:].strip()
            deat_date = datetime.datetime.strptime(date2,'%Y-%m-%d').date()
            if birt_date > deat_date:
                output = "Birth of "+ name + "\t" + str(birt_date) + " should occur before death " + str(deat_date)
                wr.write(output)
                flag = True
    if flag == False:
        wr.write("All births occur before deaths!")
989d1e7a1ee1b40baf550e4bbf152bc185161e7a
<mask token>

<mask token>


def birthBeforeDeath(IndList, wr):
    flag = False
    wr.write('\n\nUS03 - Birth before death\n')
    for date in IndList:
        if date[4][10:] == 'Alive':
            pass
        else:
            if date[1][:4] == 'NAME':
                name = date[1][5:]
            date1 = date[3][10:].strip()
            birt_date = datetime.datetime.strptime(date1, '%Y-%m-%d').date()
            date2 = date[4][10:].strip()
            deat_date = datetime.datetime.strptime(date2, '%Y-%m-%d').date()
            if birt_date > deat_date:
                output = 'Birth of ' + name + '\t' + str(birt_date
                    ) + ' should occur before death ' + str(deat_date)
                wr.write(output)
                flag = True
    if flag == False:
        wr.write('All births occur before deaths!')

import datetime


def birthBeforeDeath(IndList, wr):
    flag = False
    wr.write('\n\nUS03 - Birth before death\n')
    for date in IndList:
        if date[4][10:] == 'Alive':
            pass
        else:
            if date[1][:4] == 'NAME':
                name = date[1][5:]
            date1 = date[3][10:].strip()
            birt_date = datetime.datetime.strptime(date1, '%Y-%m-%d').date()
            date2 = date[4][10:].strip()
            deat_date = datetime.datetime.strptime(date2, '%Y-%m-%d').date()
            if birt_date > deat_date:
                output = 'Birth of ' + name + '\t' + str(birt_date
                    ) + ' should occur before death ' + str(deat_date)
                wr.write(output)
                flag = True
    if flag == False:
        wr.write('All births occur before deaths!')

import datetime 

def birthBeforeDeath(IndList,wr):
    flag = False
    wr.write("\n\nUS03 - Birth before death\n")
    for date in (IndList):
        if date[4][10:] == "Alive":
            pass
        else:
            if date[1][:4] == "NAME":
                name = date[1][5:]
                #print name
            date1 = date[3][10:].strip()
            birt_date = datetime.datetime.strptime(date1,'%Y-%m-%d').date()
            date2 = date[4][10:].strip()
            deat_date = datetime.datetime.strptime(date2,'%Y-%m-%d').date()
            if birt_date > deat_date:
                output = "Birth of "+ name + "\t" + str(birt_date) + " should occur before death " + str(deat_date)
                wr.write(output)
                flag = True
    if flag == False:
        wr.write("All births occur before deaths!")