<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pad_add(av, size=None, stlen=10):
 """ Perform linear padding for complex array The input array `av` is padded with a linear ramp starting at the edges and going outwards to an average value computed from a band of thickness `stlen` at the outer boundary of the array. Pads will only be appended, not prepended to the array. If the input array is complex, pads will be complex numbers The average is computed for phase and amplitude separately. Parameters av : complex 1D or 2D ndarray The array that will be padded. size : int or tuple of length 1 (1D) or tuple of length 2 (2D), optional The final size of the padded array. Defaults to double the size of the input array. stlen : int, optional The thickness of the frame within `av` that will be used to compute an average value for padding. Returns ------- pv : complex 1D or 2D ndarray Padded array `av` with pads appended to right and bottom. """

    if size is None:
        size = list()
        for s in av.shape:
            size.append(int(2*s))
    elif not hasattr(size, "__len__"):
        size = [size]

    assert len(av.shape) in [1, 2], "Only 1D and 2D arrays!"
    assert len(av.shape) == len(
        size), "`size` must have same length as `av.shape`!"

    if len(av.shape) == 2:
        return _pad_add_2d(av, size, stlen)
    else:
        return _pad_add_1d(av, size, stlen)