code: def parse_header(head):
      
      try:
          (fromcall, path) = head.split('>', 1)
      except:
          raise ParseError("invalid packet header")
  
      if (not 1 <= len(fromcall) <= 9 or
         not re.findall(r"^[a-z0-9]{0,9}(\-[a-z0-9]{1,8})?$", fromcall, re.I)):
  
          raise ParseError("fromcallsign is invalid")
  
      path = path.split(',')
  
      if len(path[0]) == 0:
          raise ParseError("no tocallsign in header")
  
      tocall = path[0]
      path = path[1:]
  
      validate_callsign(tocall, "tocallsign")
  
      for digi in path:
          if not re.findall(r"^[A-Z0-9\-]{1,9}\*?$", digi, re.I):
              raise ParseError("invalid callsign in path")
  
      parsed = {
          'from': fromcall,
          'to': tocall,
          'path': path,
          }
  
      viacall = ""
      if len(path) >= 2 and re.match(r"^q..$", path[-2]):
          viacall = path[-1]
  
      parsed.update({'via': viacall})
  
      return parsed
docs: Parses the header part of packet
      Returns a dict