<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ensure_ridge_is_scalar_or_none(ridge):
 """ Ensures that `ridge` is either None or a scalar value. Raises a helpful TypeError otherwise. Parameters ridge : int, float, long, or None. Scalar value or None, determining the L2-ridge regression penalty. Returns ------- None. """

    if (ridge is not None) and not isinstance(ridge, Number):
        msg_1 = "ridge should be None or an int, float, or long."
        msg_2 = "The passed value of ridge had type: {}".format(type(ridge))
        raise TypeError(msg_1 + msg_2)

    return None