def METHOD_NAME(self, active=None, masterid=None):
    d = defer.DeferredList([
        self.getChangeSource(id) for id in self.changesources
    ])
    @d.addCallback
    def filter(results):
        # filter off the DeferredList results (we know it's good)
        results = [r[1] for r in results]
        # filter for masterid
        if masterid is not None:
            results = [r for r in results
                       if r['masterid'] == masterid]
        # filter for active or inactive if necessary
        if active:
            results = [r for r in results
                       if r['masterid'] is not None]
        elif active is not None:
            results = [r for r in results
                       if r['masterid'] is None]
        return results
    return d