code: def _add_source(self, source):
          
  
          try:
  
              self._add_child(source)
  
          except AttributeError:
  
              if isinstance(source, Source):
  
                  raise DuplicatedNode("More than one source with the name '%s'. You cannot use the same name for multiple "
                                       "sources" % source.name)
  
              else:  # pragma: no cover
  
                  raise
  
          # Now see if this is a point or extended source, and add them to the
          # appropriate dictionary
  
          if source.source_type == POINT_SOURCE:
  
              self._point_sources[source.name] = source
  
          elif source.source_type == EXTENDED_SOURCE:
  
              self._extended_sources[source.name] = source
  
          elif source.source_type == PARTICLE_SOURCE:
  
              self._particle_sources[source.name] = source
  
          else:  # pragma: no cover
  
              raise InvalidInput("Input sources must be either a point source or an extended source")
docs: Remember to call _update_parameters after this!
          :param source:
          :return: