def METHOD_NAME(digest):
    """
    Given a digested result, calculate mean tx/rx kpps
    Args: Digested samples
    Returns:  a dictionary with the following format
    {
    "nsamples": 52
    "result": {
        0: {
            "TX": 2352.238
            "RX": 4581.312
        },
        1: ...
    }
    }
    """
    result= {}
    for port in digest[0].get("packets"):
        result[port]= {
                "TX": statistics.mean(
                    [sample["packets"][port]["tx_delta"]/
                        sample["time_delta"] for sample in digest]) / 1000,
                "RX": statistics.mean(
                    [sample["packets"][0]["rx_delta"]/
                        sample["time_delta"] for sample in digest]) / 1000
                 }
    return {
            "nsamples": len(digest),
            "result": result
            }