exceptions and assertions finger exerciseimplement function that satisfies the specification def findaneven( )"""assumes is list of integers returns the first even number in raises valueerror if does not contain an even number""consider the function definition in figure def getratios(vect vect )"""assumesvect and vect are lists of equal length of numbers returnsa list containing the meaningful values of vect [ ]/vect [ ]""ratios [for index in range(len(vect ))tryratios append(vect [index]/float(vect [index])except zerodivisionerrorratios append(float('nan')#nan not number exceptraise valueerror('getratios called with bad arguments'return ratios figure using exceptions for control flow there are two except blocks associated with the try block if an exception is raised within the try blockpython first checks to see if it is zerodivisionerror if soit appends special valuenanof type float to ratios (the value nan stands for "not number there is no literal for itbut it can be denoted by converting the string 'nanor the string 'nanto type float when nan is used as an operand in an expression of type floatthe value of that expression is also nan if the exception is anything other than zerodivisionerrorthe code executes the second except blockwhich raises valueerror exception with an associated string in principlethe second except block should never be enteredbecause the code invoking getratios should respect the assumptions in the specification of getratios howeversince checking these assumptions imposes only an insignificant computational burdenit is probably worth practicing defensive programming and checking anyway the following code illustrates how program might use getratios the name msg in the line except valueerrormsgis bound to the argument ( string in this caseassociated with valueerror when it was raised when executed