def _result_shape(shape_list):
    """Return the result of broadcasting `shapes` against each other"""
    ret_ndim = 0
    for shape in shape_list:
        if len(shape) > ret_ndim:
            ret_ndim = len(shape)
    for shape in shape_list:
        for dim in shape:
            if dim == 0:
                return tuple([0] * ret_ndim)
    for i in range(len(shape_list)):
        shape_list[i] = [1] * (ret_ndim - len(shape_list[i])) + list(shape_list
            [i])
    ret = []
    for i in range(ret_ndim):
        greatest = 0
        for shape in shape_list:
            if shape[i] > greatest:
                greatest = shape[i]
        ret.append(greatest)
    return tuple(ret)
