<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_background(self, color, loc='all'):
 """ Sets background color Parameters color : string or 3 item list, optional, defaults to white Either a string, rgb list, or hex color string. For example: color='white' color='w' color=[1, 1, 1] color='#FFFFFF' loc : int, tuple, list, or str, optional Index of the renderer to add the actor to. For example, ``loc=2`` or ``loc=(1, 1)``. If ``loc='all'`` then all render windows will have their background set. """

        if color is None:
            color = rcParams['background']
        if isinstance(color, str):
            if color.lower() in 'paraview' or color.lower() in 'pv':
                # Use the default ParaView background color
                color = PV_BACKGROUND
            else:
                color = vtki.string_to_rgb(color)

        if loc =='all':
            for renderer in self.renderers:
                renderer.SetBackground(color)
        else:
            renderer = self.renderers[self.loc_to_index(loc)]
            renderer.SetBackground(color)