docs: def solve_with_glpsol(glp_prob):
      """Solve glpk problem with glpsol commandline solver. Mainly for testing purposes.
  
      # Examples
      # --------
  
      # >>> problem = glp_create_prob()
      # ... glp_read_lp(problem, None, "../tests/data/model.lp")
      # ... solution = solve_with_glpsol(problem)
      # ... print 'asdf'
      # 'asdf'
      # >>> print solution
      # 0.839784
  
      # Returns
      # -------
      # dict
      #     A dictionary containing the objective value (key ='objval')
      #     and variable primals.
      """
      from swiglpk import glp_get_row_name, glp_get_col_name, glp_write_lp, glp_get_num_rows, glp_get_num_cols
  
      row_ids = [glp_get_row_name(glp_prob, i) for i in range(1, glp_get_num_rows(glp_prob) + 1)]
  
      col_ids = [glp_get_col_name(glp_prob, i) for i in range(1, glp_get_num_cols(glp_prob) + 1)]
  
      with tempfile.NamedTemporaryFile(suffix=".lp", delete=True) as tmp_file:
          tmp_file_name = tmp_file.name
          glp_write_lp(glp_prob, None, tmp_file_name)
          cmd = ['glpsol', '--lp', tmp_file_name, '-w', tmp_file_name + '.sol', '--log', '/dev/null']
          term = check_output(cmd)
          log.info(term)
  
      try:
          with open(tmp_file_name + '.sol') as sol_handle:
              # print sol_handle.read()
              solution = dict()
              for i, line in enumerate(sol_handle.readlines()):
                  if i <= 1 or line == '\n':
                      pass
                  elif i <= len(row_ids):
                      solution[row_ids[i - 2]] = line.strip().split(' ')
                  elif i <= len(row_ids) + len(col_ids) + 1:
                      solution[col_ids[i - 2 - len(row_ids)]] = line.strip().split(' ')
                  else:
                      print(i)
                      print(line)
                      raise Exception("Argggh!")
      finally:
          os.remove(tmp_file_name + ".sol")
      return solution