def clean(self):
        # if it's inactive, then do no validation
        if self.is_active is False:
            return

        # check against TWITTER_DEFAULT_USERNAME
        if self.user.username == settings.TWITTER_DEFAULT_USERNAME:
            raise ValidationError('''Streamsample is also configured to
                                     authenticate as \'%s\'.  Please select
                                     a different user or mark this filter as
                                     inactive.''' % self.user.username)

        # check against other active TwitterFilters' user.usernames
        conflicting_tfs = \
            TwitterFilter.objects.exclude(id=self.id).\
            filter(is_active=True, user__username=self.user.username)
        if conflicting_tfs:
            raise ValidationError('''Filter %d is active and is configured
                                     to authenticate as \'%s\'.
                                     Please select a different user or mark
                                     this filter as inactive.''' %
                                  (conflicting_tfs[0].id, self.user.username))

        # update line-breaks in words with spaces
        if self.words != '':
            wrd = self.words
            wrd = re.sub('\n|\r', ' ', wrd)
            self.words = wrd

        # replace line-breaks with space
        if self.people != '':
            ppl = self.people
            ppl = re.sub('\n|\r', ' ', ppl)
            ppl = ppl.lstrip().rstrip().lstrip(',').rstrip(',')
            ppl = re.sub('\s*,\s*', ',', ppl)
            if ' ' in ''.join(ppl):
                raise ValidationError("Please use commas to separate \
                        the list of twitter usernames")
            else:
                ppl = re.sub(',', ', ', ppl)
            self.people = ppl

        # check against values and length
        if self.locations != '':
            self.locations = re.sub('\n|\r|\s', '', self.locations)
            # Ensure it's a list of 4-tuples
            loclist = self.locations.split(',')
            if len(loclist) % 4 != 0:
                raise ValidationError("Locations must include valid, \
                    comma-separated bounding boxes.")
            # Each lat/long value must be numeric and between -180 and 180
            try:
                for loc in loclist:
                    if not(-180 <= float(loc) < 180):
                        raise ValidationError("Invalid bounding box; each \
                            long/lat value must be between -180 and 180")
            except __HOLE__:
                raise ValidationError("Invalid bounding box; each \
                        long/lat value must be between -180 and 180")
dataset/ETHPy150Open gwu-libraries/social-feed-manager/sfm/ui/models.py/TwitterFilter.clean