Parse RESERVOIR Link Method

def reservoirLink(lines):
    """
    Parse RESERVOIR Link Method
    """
    # Constants
    KEYWORDS = ('LINK',
                'RESERVOIR',
                'RES_MINWSE',
                'RES_INITWSE',
                'RES_MAXWSE',
                'RES_NUMPTS',
                'LAKE',
                'MINWSE',
                'INITWSE',
                'MAXWSE',
                'NUMPTS')

    result  =  {'header': {'link': None,
                           'res_minwse': None,
                           'res_initwse': None,
                           'res_maxwse': None,
                           'res_numpts': None,
                           'minwse': None,
                           'initwse': None,
                           'maxwse': None,
                           'numpts': None},
                'type': None,
                'points': []}

    pair = {'i': None,
            'j': None}

    # Rechunk the chunk
    chunks = pt.chunk(KEYWORDS, lines)

    # Parse chunks associated with each key
    for key, chunkList in iteritems(chunks):
        # Parse each chunk in the chunk list
        for chunk in chunkList:
            schunk = chunk[0].strip().split()


            # Cases
            if key in ('NUMPTS', 'RES_NUMPTS'):
                # Points handler
                result['header'][key.lower()] = schunk[1]

                # Parse points
                for idx in range(1, len(chunk)):
                    schunk = chunk[idx].strip().split()

                    for count, ordinate in enumerate(schunk):
                        # Divide ordinates into ij pairs
                        if (count % 2) == 0:
                            pair['i'] = ordinate
                        else:
                            pair['j'] = ordinate
                            result['points'].append(pair)
                            pair = {'i': None,
                                    'j': None}

            elif key in ('LAKE', 'RESERVOIR'):
                # Type handler
                result['type'] = schunk[0]
            else:
                # Header variables handler
                result['header'][key.lower()] = schunk[1]
    return result