def summarize_packet(pkt):
    """
    Summarizes a packet into a human-legible string. Five key fields are represented
    in the summary - source/destination IP, source/destination MAC address, source/
    destination TCP/UDP port, and the transport protocol in use (such as TCP/UDP).
    If any of the five key fields are missing, they are replaced with the text
    "None".

    Args:
        pkt: A pyshark.packet object that will be summarized
    
    Returns:
        String representing the summary of a packet
    """
    try:
        l4_protocol = pkt[2].name
    except (AttributeError, IndexError):
        l4_protocol = "None"
    try:
        src_mac = pkt["Ethernet"].src
    except (AttributeError, IndexError):
        src_mac = "None"
    try:
        dst_mac = pkt["Ethernet"].dst
    except (AttributeError, IndexError):
        dst_mac = "None"
    try:
        src_ip = pkt["IP"].src
    except (AttributeError, IndexError):
        src_ip = "None"
    try:
        dst_ip = pkt["IP"].dst
    except (AttributeError, IndexError):
        dst_ip = "None"
    try:
        src_port = pkt[2].sport
    except (AttributeError, IndexError):
        src_port = "None"
    try:
        dst_port = pkt[2].dport
    except (AttributeError, IndexError):
        dst_port = "None"
    try:
        app_protocol = pkt.lastlayer().name
    except (AttributeError, IndexError):
        app_protocol = "Unknown"
    return "{!s: <5} ({!s: <7}) {!s: <17} {!s: >15}:{!s: <6} -> {!s: >15}:{!s: <6} {!s: <17}".format(l4_protocol, app_protocol, src_mac, src_ip, src_port, dst_ip, dst_port, dst_mac)