'Parses and adds a PlotMode to the function
list.'

def __setitem__(self, i, args):

    if (not (isinstance(i, (int, Integer)) and (i >= 0))):
        raise ValueError('Function    index    must    be    an    integer    >=    0.')
    if isinstance(args, PlotObject):
        f = args
    else:
        if ((not is_sequence(args)) or isinstance(args, GeometryEntity)):
            args = [args]
        if (len(args) == 0):
            return
        kwargs = dict(bounds_callback=self.adjust_all_bounds)
        f = PlotMode(*args, **kwargs)
    if f:
        self._render_lock.acquire()
        self._functions[i] = f
        self._render_lock.release()
    else:
        raise ValueError(("Failed    to    parse    '%s'." % ',    '.join((str(a) for a in args))))
