code: def getbase(base=None, dims=None, extent=None, background=None):
      
      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
docs: Construct a base array from optional arguments.