import struct


def extractTcpPayload(tcp_packet):
    """Extract the TCP payload and headers"""

    readable_tcp_header = ""
    tcp_header = tcp_packet[:20]

    tcph = struct.unpack('!HHLLBBHHH', tcp_header)

    src_port = tcph[0]
    dst_port = tcph[1]
    doff_reserved = tcph[4]
    tcph_length = doff_reserved >> 4
    h_size = tcph_length * 4

    readable_tcp_header += f"Source Port:         {src_port}\n"
    readable_tcp_header += f"Dest Port:           {dst_port}\n"
    readable_tcp_header += f"Sequence Number:     {tcph[2]}\n"
    readable_tcp_header += f"Acknowledgement:     {tcph[3]}\n"
    readable_tcp_header += f"TCP header length:   {h_size} bytes\n"

    # get data from the packet
    tcp_payload = tcp_packet[h_size:]

    return readable_tcp_header, tcp_payload, src_port, dst_port