def get_answer(answers, expected_flags="PA", expected_seqno=None, expected_ackno=None):
    """
    Helper script to parse through a list of potential answers to find the
    actual response packet we care about. Scapy normally does much of this
    checking for us when we use `sr`, but due to censorship, it's possible to
    receive multiple copies of the same packet or other unexpected packets.
    Args:
        answers (list): List of answer packets tuples from `sr`
        expected_flags (str, optional): TCP flags on the expected packet
        expected_seqno (int, optional): Sequence number on the expected packet
        expected_ackno (int, optional): Acknowledgment number on the expected packet
    """
    print("Parsing answer out of %d potential answers" % len(answers))
    for packet in answers:
        if not packet.haslayer("TCP"):
            print("Ignoring non TCP packet")
            continue
        if packet["TCP"].flags != expected_flags:
            print("Ignoring packet with unexpected flags:", packet.summary())
            continue
        if expected_seqno is not None and packet["TCP"].seq != expected_seqno:
            print("Ignoring packet with unexpected seqno %d (expected: %d)" % (packet["TCP"].seq, expected_seqno), packet.summary())
            continue
        if expected_ackno is not None and packet["TCP"].ack != expected_ackno:
            print("Ignoring packet with unexpected ackno %d (expected: %d)" % (packet["TCP"].ack, expected_ackno), packet.summary())
            continue
        return packet
    return None