<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def doOutages(self):
 """ Applies branch outtages. """

        assert len(self.branchOutages) == len(self.market.case.branches)

        weights = [[(False, r), (True, 1 - (r))] for r in self.branchOutages]

        for i, ln in enumerate(self.market.case.branches):
            ln.online = weighted_choice(weights[i])
            if ln.online == False:
                print "Branch outage [%s] in period %d." %(ln.name,self.stepid)