<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_coef(clf, label_id, scale=None):
 """ Return a vector of coefficients for a given label, including bias feature. ``scale`` (optional) is a scaling vector; coef_[i] => coef[i] * scale[i] if scale[i] is not nan. Intercept is not scaled. """

    if len(clf.coef_.shape) == 2:
        # Most classifiers (even in binary case) and regressors
        coef = _dense_1d(clf.coef_[label_id])
    elif len(clf.coef_.shape) == 1:
        # SGDRegressor stores coefficients in a 1D array
        if label_id != 0:
            raise ValueError(
                'Unexpected label_id %s for 1D coefficient' % label_id)
        coef = _dense_1d(clf.coef_)
    elif len(clf.coef_.shape) == 0:
        # Lasso with one feature: 0D array
        coef = np.array([clf.coef_])
    else:
        raise ValueError('Unexpected clf.coef_ shape: %s' % clf.coef_.shape)

    if scale is not None:
        if coef.shape != scale.shape:
            raise ValueError("scale shape is incorrect: expected %s, got %s" % (
                coef.shape, scale.shape,
            ))
        # print("shape is ok")
        not_nan = ~np.isnan(scale)
        coef = coef.copy()
        coef[not_nan] *= scale[not_nan]

    if not has_intercept(clf):
        return coef
    if label_id == 0 and not isinstance(clf.intercept_, np.ndarray):
        bias = clf.intercept_
    else:
        bias = clf.intercept_[label_id]
    return np.hstack([coef, bias])