<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_hist_files(histf):
 """parse histogram files"""

        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