from typing import Dict
from typing import List
import re


def _parse_audit_message(audit_str: str) -> Dict[str, List[str]]:
    """
    Parse an auditd message string into Dict format required by unpack_auditd.

    Parameters
    ----------
    audit_str : str
        The Audit message

    Returns
    -------
    Dict[str, str]
        The extracted message values

    """
    audit_message = audit_str.rstrip().split(": ")
    audit_headers = audit_message[0]
    audit_hdr_match = re.match(r"type=([^\s]+)", audit_headers)
    if audit_hdr_match:
        return {audit_hdr_match.group(1): audit_message[1].split(" ")}
    return {}