code: def parse_hist_files(histf):
          
          nameddata = dict()
          data = dict()
          try:
              for l in histf['f'].splitlines():
                  s = l.split()
                  if s:
                      if len(s) != 2:
                          raise RuntimeError("invalid format: " + str(len(s)) + " column(s) found in row. must be exactly 2.")
                      data[int(s[0])] = int(s[1])
          except Exception as err:
              log.warning("Error parsing %s. %s", histf['fn'], err)
              log.debug(traceback.format_exc())
          else:
              if data:
                  nameddata[histf['s_name']] = data
              else:
                  log.debug("%s is empty.", histf['fn'])
          finally:
              return nameddata
docs: parse histogram files