def METHOD_NAME(rec: Dict[str, Any]) -> Record:
    """Prepares a document"""
    if "id_orig_h" in rec:
        rec["src"] = rec.pop("id_orig_h")
    elif "pkt_src" in rec:
        rec["src"] = rec.pop("pkt_src")
    if "id_resp_h" in rec:
        rec["dst"] = rec.pop("id_resp_h")
    elif "pkt_dst" in rec:
        rec["dst"] = rec.pop("pkt_dst")
    if "ts" in rec:
        rec["start_time"] = rec["end_time"] = rec.pop("ts")
    if rec.get("proto", None) == "icmp":
        # FIXME incorrect: source & dest flow?
        rec["type"], rec["code"] = rec.pop("id_orig_p"), rec.pop("id_resp_p")
    elif "id_orig_p" in rec and "id_resp_p" in rec:
        rec["sport"], rec["dport"] = rec.pop("id_orig_p"), rec.pop("id_resp_p")
    return rec