<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_outlets(self, pores=[], overwrite=False):
 r""" Set the locations through which defender exits the network. This is only necessary if 'trapping' was set to True when ``setup`` was called. Parameters pores : array_like Locations where the defender can exit the network. Any defender that does not have access to these sites will be trapped. overwrite : boolean If ``True`` then all existing outlet locations will be removed and then the supplied locations will be added. If ``False`` (default), then supplied locations are added to any already existing outlet locations. """

        if self.settings['trapping'] is False:
            logger.warning('Setting outlets is meaningless unless trapping ' +
                           'was set to True during setup')
        Ps = self._parse_indices(pores)
        if np.sum(self['pore.inlets'][Ps]) > 0:
            raise Exception('Some outlets are already defined as inlets')
        if overwrite:
            self['pore.outlets'] = False
        self['pore.outlets'][Ps] = True