code: def _parse_nodes_section(f, current_section, nodes):
      
      section = {}
      dimensions = None
  
      if current_section == 'NODE_COORD_SECTION':
          dimensions = 3 # i: (i, j)
      elif current_section == 'DEMAND_SECTION':
          dimensions = 2 # i: q
      else:
          raise ParseException('Invalid section {}'.format(current_section))
  
      n = 0
      for line in f:
          line = strip(line)
  
          # Check dimensions
          definitions = re.split(r'\s*', line)
          if len(definitions) != dimensions:
              raise ParseException('Invalid dimensions from section {}. Expected: {}'.format(current_section, dimensions))
  
          node = int(definitions[0])
          values = [int(v) for v in definitions[1:]]
  
          if len(values) == 1:
              values = values[0]
  
          section[node] = values
  
          n = n + 1
          if n == nodes:
              break
  
      # Assert all nodes were read
      if n != nodes:
          raise ParseException('Missing {} nodes definition from section {}'.format(nodes - n, current_section))
  
      return section
docs: Parse TSPLIB NODE_COORD_SECTION or DEMAND_SECTION from file descript f
  
      Returns a dict containing the node as key