code: def load_protocols(filename, _integer_base=10):
      Parse /etc/protocols and return values as a dictionary."""
      spaces = re.compile(b"[ \t]+|\n")
      dct = DADict(_name=filename)
      try:
          with open(filename, "rb") as fdesc:
              for line in fdesc:
                  try:
                      shrp = line.find(b"#")
                      if shrp >= 0:
                          line = line[:shrp]
                      line = line.strip()
                      if not line:
                          continue
                      lt = tuple(re.split(spaces, line))
                      if len(lt) < 2 or not lt[0]:
                          continue
                      dct[lt[0]] = int(lt[1], _integer_base)
                  except Exception as e:
                      log_loading.info(
                          "Couldn't parse file [%s]: line [%r] (%s)",
                          filename,
                          line,
                          e,
                      )
      except IOError:
          log_loading.info("Can't open %s file", filename)
      return dct
docs: Parse /etc/protocols and return values as a dictionary.