<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_cuboid(space, min_pt=None, max_pt=None, axis=0):
 """Cuboid with smooth variations. Parameters space : `DiscreteLp` Discretized space in which the phantom is supposed to be created. min_pt : array-like of shape ``(space.ndim,)``, optional Lower left corner of the cuboid. If ``None`` is given, a quarter of the extent from ``space.min_pt`` towards the inside is chosen. max_pt : array-like of shape ``(space.ndim,)``, optional Upper right corner of the cuboid. If ``None`` is given, ``min_pt`` plus half the extent is chosen. axis : int or sequence of int Dimension(s) along which the smooth variation should happen. Returns ------- phantom : ``space``-element The generated cuboid phantom in ``space``. Values have range [0, 1]. """

    dom_min_pt = space.domain.min()
    dom_max_pt = space.domain.max()

    if min_pt is None:
        min_pt = dom_min_pt * 0.75 + dom_max_pt * 0.25
    if max_pt is None:
        max_pt = dom_min_pt * 0.25 + dom_max_pt * 0.75

    min_pt = np.atleast_1d(min_pt)
    max_pt = np.atleast_1d(max_pt)

    axis = np.array(axis, dtype=int, ndmin=1)

    if min_pt.shape != (space.ndim,):
        raise ValueError('shape of `min_pt` must be {}, got {}'
                         ''.format((space.ndim,), min_pt.shape))
    if max_pt.shape != (space.ndim,):
        raise ValueError('shape of `max_pt` must be {}, got {}'
                         ''.format((space.ndim,), max_pt.shape))

    sign = 0
    for i, coord in enumerate(space.meshgrid):
        sign = sign | (coord < min_pt[i]) | (coord > max_pt[i])

    values = 0
    for i in axis:
        coord = space.meshgrid[i]
        extent = (dom_max_pt[i] - dom_min_pt[i])
        values = values + 2 * (coord - dom_min_pt[i]) / extent - 1

    # Properly scale using sign
    sign = (3 * sign - 2) / axis.size

    # Fit in [0, 1]
    values = values * sign
    values = (values - np.min(values)) / (np.max(values) - np.min(values))

    return space.element(values)