<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(data, padwidth, value=0.0):
 """ Pad an array with a specific value. Parameters data : ndarray Numpy array of any dimension and type. padwidth : int or tuple If int, it will pad using this amount at the beginning and end of all dimensions. If it is a tuple (of same length as `ndim`), then the padding amount will be specified per axis. value : data.dtype The value with which to pad. Default is ``0.0``. See also -------- pad_to_size, pad_repeat_border, pad_repeat_border_corner Examples -------- Pad an array with zeros. array([[ 0., 0., 0., 0., 0., 0., 0.], [ 0., 0., 1., 1., 1., 0., 0.], [ 0., 0., 1., 1., 1., 0., 0.], [ 0., 0., 1., 1., 1., 0., 0.], [ 0., 0., 0., 0., 0., 0., 0.]]) """

    data = np.asarray(data)
    shape = data.shape
    if isinstance(padwidth, int):
        padwidth = (padwidth,)*len(shape)

    padded_shape = tuple(map(lambda ix: ix[1]+padwidth[ix[0]]*2,
                             enumerate(shape)))
    new_data = np.empty(padded_shape, dtype=data.dtype)
    new_data[..., :] = value
    new_data[[slice(w, -w) if w > 0 else slice(None) for w in padwidth]] = data
    return new_data