<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getbase(base=None, dims=None, extent=None, background=None):
 """ Construct a base array from optional arguments. """

    if dims is not None:
        extent = dims
    if base is None and background is None:
        return ones(tuple(extent) + (3,))
    elif base is None and background is not None:
        base = zeros(tuple(extent) + (3,))
        for channel in range(3):
            base[:, :, channel] = background[channel]
        return base
    elif base is not None and base.ndim < 3:
        return tile(expand_dims(base, 2),[1, 1, 3])
    else:
        return base