def get_dimension(cone):
    """
    `cone` holds the dimensions of the individual cones.
    Calculate and return the sum of all the cone dimensions.

    For PSD-cones consider the vector-length of the upper-triangle.
    """
    dim = 0
    for k in cone:
        if k == "f" or k == "l":
            dim += cone[k]
        elif k == "q" or k == "s":
            dim += sum(cone[k])
        elif k == "ep" or k == "ed":
            dim += cone[k] * 3
        elif k == "p":
            dim += len(cone[k]) * 3
        elif k == "b":
            dim += cone[k]
        else:
            raise ValueError("cone key unknown.")
    return dim