def get_cmd(chk):
    """
    Assemble the correct "packet-tracer" command based on the "proto"
    value. TCP/UDP use source/destination ports, ICMP uses type/code,
    and other protocols use neither. Returns a valid "packet-tracker"
    command that can be issued to an ASA without further modification.
    """

    proto = str(chk["proto"]).lower()
    cmd = f"packet-tracer input {chk['in_intf']} "

    # Check for TCP or UDP
    if proto in ["tcp", "udp"]:
        cmd += (
            f"{proto} {chk['src_ip']} {chk['src_port']} "
            f"{chk['dst_ip']} {chk['dst_port']} "
        )

    # Check for ICMP
    elif proto == "icmp":
        cmd += (
            f"icmp {chk['src_ip']} {chk['icmp_type']} "
            f"{chk['icmp_code']} {chk['dst_ip']} "
        )

    # Protocol is an uncommon protocol specified numerically
    else:
        cmd += f"rawip {chk['src_ip']} {chk['proto']} {chk['dst_ip']} "

    # Append "xml" to the command string to specify XML output format
    return cmd + "xml"