def _multi_dot_three(A, B, C):
    # cost1 = cost((AB)C)
    cost1 = (A.shape[0] * A.shape[1] * B.shape[1] +  # (AB)
             A.shape[0] * B.shape[1] * C.shape[1])   # (--)C
    # cost2 = cost((AB)C)
    cost2 = (B.shape[0] * B.shape[1] * C.shape[1] +  #  (BC)
             A.shape[0] * A.shape[1] * C.shape[1])   # A(--)

    if cost1 < cost2:
        return _dot(_dot(A, B), C)
    else:
        return _dot(A, _dot(B, C))
Given a port, calculates the remote sg references by ip_version.
dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/regression/mixed_linear_model.py/_multi_dot_three--crossover with--dataset/ETHPy150Open openstack/neutron/neutron/agent/linux/iptables_firewall.py/IptablesFirewallDriver._get_remote_sg_ids_sets_by_ipversion