<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def smooth_1D(arr, n=10, smooth_type="flat") -> np.ndarray: """Smooth 1D data using a window function. Edge effects will be present. Parameters arr : array_like Input array, 1D. n : int (optional) Window length. smooth_type : {'flat', 'hanning', 'hamming', 'bartlett', 'blackman'} (optional) Type of window function to convolve data with. 'flat' window will produce a moving average smoothing. Returns ------- array_like Smoothed 1D array. """


    # check array input
    if arr.ndim != 1:
        raise wt_exceptions.DimensionalityError(1, arr.ndim)
    if arr.size < n:
        message = "Input array size must be larger than window size."
        raise wt_exceptions.ValueError(message)
    if n < 3:
        return arr
    # construct window array
    if smooth_type == "flat":
        w = np.ones(n, dtype=arr.dtype)
    elif smooth_type == "hanning":
        w = np.hanning(n)
    elif smooth_type == "hamming":
        w = np.hamming(n)
    elif smooth_type == "bartlett":
        w = np.bartlett(n)
    elif smooth_type == "blackman":
        w = np.blackman(n)
    else:
        message = "Given smooth_type, {0}, not available.".format(str(smooth_type))
        raise wt_exceptions.ValueError(message)
    # convolve reflected array with window function
    out = np.convolve(w / w.sum(), arr, mode="same")
    return out