Write Reservoir/Lake Link to File Method

def _writeReservoirLink(self, link, fileObject, replaceParamFile):
        """
        Write Reservoir/Lake Link to File Method
        """
        fileObject.write('%s\n' % link.type)

        # Retrieve reservoir
        reservoir = link.reservoir

        # Reservoir parameters
        initWSE = vwp(reservoir.initWSE, replaceParamFile)
        minWSE = vwp(reservoir.minWSE, replaceParamFile)
        maxWSE = vwp(reservoir.maxWSE, replaceParamFile)
        numElements = link.numElements

        # Cases
        if link.type == 'LAKE':
            # Lake handler
            try:
                fileObject.write('INITWSE      %.6f\n' % initWSE)
            except:
                fileObject.write('INITWSE      %s\n' % initWSE)

            try:
                fileObject.write('MINWSE       %.6f\n' % minWSE)
            except:
                fileObject.write('MINWSE       %s\n' % minWSE)

            try:
                fileObject.write('MAXWSE       %.6f\n' % maxWSE)
            except:
                fileObject.write('MAXWSE       %s\n' % maxWSE)

            fileObject.write('NUMPTS       %s\n' % numElements)

        elif link.type == 'RESERVOIR':
            # Reservoir handler
            try:
                fileObject.write('RES_INITWSE      %.6f\n' % initWSE)
            except:
                fileObject.write('RES_INITWSE      %s\n' % initWSE)

            try:
                fileObject.write('RES_MINWSE       %.6f\n' % minWSE)
            except:
                fileObject.write('RES_MINWSE       %s\n' % minWSE)

            try:
                fileObject.write('RES_MAXWSE       %.6f\n' % maxWSE)
            except:
                fileObject.write('RES_MAXWSE       %s\n' % maxWSE)

            fileObject.write('RES_NUMPTS       %s\n' % numElements)

        # Retrieve reservoir points
        points = reservoir.reservoirPoints

        for idx, point in enumerate(points):
            if ((idx + 1) % 10) != 0:
                fileObject.write('%s  %s     ' % (point.i, point.j))
            else:
                fileObject.write('%s  %s\n' % (point.i, point.j))

        if (link.numElements % 10) != 0:
            fileObject.write('\n')