parameters: (self, source=None, date=None, remove_all=False)
docstring: Remove a source or source instance from a top-level object.
  
          :param source: Name of the source.
          :type source: str
          :param date: Date to match on.
          :type date: datetime.datetime
          :param remove_all: Remove all instances of this source.
          :type remove_all: boolean
          :returns: dict with keys "success" (boolean) and "message" (str)
docstring_summary: Remove a source or source instance from a top-level object.
docstring_tokens: Remove a source or source instance from a top - level object .
function: def remove_source(self, source=None, date=None, remove_all=False):
          """
          Remove a source or source instance from a top-level object.
  
          :param source: Name of the source.
          :type source: str
          :param date: Date to match on.
          :type date: datetime.datetime
          :param remove_all: Remove all instances of this source.
          :type remove_all: boolean
          :returns: dict with keys "success" (boolean) and "message" (str)
          """
  
          keepone = {'success': False,
                     'message': "Must leave at least one source for access controls.  "
                     "If you wish to change the source, please assign a new source and then remove the old."}
  
          if not source:
              return {'success': False,
                      'message': 'No source to locate'}
          if not remove_all and not date:
              return {'success': False,
                      'message': 'Not removing all and no date to find.'}
          for s in self.source:
              if s.name == source:
                  if remove_all:
                      if len(self.source) > 1:
                          self.source.remove(s)
                          message = "Deleted source %s" % source
                          return {'success': True,
                                  'message': message}
                      else:
                          return keepone
                  else:
                      for si in s.instances:
                          if si.date == date:
                              if len(s.instances) > 1:
                                  s.instances.remove(si)
                                  message = "Deleted instance of  %s" % source
                                  return {'success': True,
                                          'message': message}
                              else:
                                  if len(self.source) > 1:
                                      self.source.remove(s)
                                      message = "Deleted source %s" % source
                                      return {'success': True,
                                              'message': message}
                                  else:
                                      return keepone
function_tokens: def remove_source ( self , source = None , date = None , remove_all = False ) : keepone = { 'success' : False , 'message' : "Must leave at least one source for access controls.  " "If you wish to change the source, please assign a new source and then remove the old." } if not source : return { 'success' : False , 'message' : 'No source to locate' } if not remove_all and not date : return { 'success' : False , 'message' : 'Not removing all and no date to find.' } for s in self . source : if s . name == source : if remove_all : if len ( self . source ) > 1 : self . source . remove ( s ) message = "Deleted source %s" % source return { 'success' : True , 'message' : message } else : return keepone else : for si in s . instances : if si . date == date : if len ( s . instances ) > 1 : s . instances . remove ( si ) message = "Deleted instance of  %s" % source return { 'success' : True , 'message' : message } else : if len ( self . source ) > 1 : self . source . remove ( s ) message = "Deleted source %s" % source return { 'success' : True , 'message' : message } else : return keepone