<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def citeFilter(self, keyString = '', field = 'all', reverse = False, caseSensitive = False):
 """Filters `Records` by some string, _keyString_, in their citations and returns all `Records` with at least one citation possessing _keyString_ in the field given by _field_. # Parameters _keyString_ : `optional [str]` > Default `''`, gives the string to be searched for, if it is is blank then all citations with the specified field will be matched _field_ : `optional [str]` > Default `'all'`, gives the component of the citation to be looked at, it can be one of a few strings. The default is `'all'` which will cause the entire original `Citation` to be searched. It can be used to search across fields, e.g. `'1970, V2'` is a valid keystring The other options are: + `'author'`, searches the author field + `'year'`, searches the year field + `'journal'`, searches the journal field + `'V'`, searches the volume field + `'P'`, searches the page field + `'misc'`, searches all the remaining uncategorized information + `'anonymous'`, searches for anonymous `Citations`, _keyString_ is not ignored + `'bad'`, searches for bad citations, keyString is not used _reverse_ : `optional [bool]` > Default `False`, being set to `True` causes all `Records` not matching the query to be returned _caseSensitive_ : `optional [bool]` > Default `False`, if `True` causes the search across the original to be case sensitive, **only** the `'all'` option can be case sensitive """

        retRecs = []
        keyString = str(keyString)
        for R in self:
            try:
                if field == 'all':
                    for cite in R.get('citations'):
                        if caseSensitive:
                            if keyString in cite.original:
                                retRecs.append(R)
                                break
                        else:
                            if keyString.upper() in cite.original.upper():
                                retRecs.append(R)
                                break
                elif field == 'author':
                    for cite in R.get('citations'):
                        try:
                            if keyString.upper() in cite.author.upper():
                                retRecs.append(R)
                                break
                        except AttributeError:
                            pass
                elif field == 'journal':
                    for cite in R.get('citations'):
                        try:
                            if keyString.upper() in cite.journal:
                                retRecs.append(R)
                                break
                        except AttributeError:
                            pass
                elif field == 'year':
                    for cite in R.get('citations'):
                        try:
                            if int(keyString) == cite.year:
                                retRecs.append(R)
                                break
                        except AttributeError:
                            pass
                elif field == 'V':
                    for cite in R.get('citations'):
                        try:
                            if keyString.upper() in cite.V:
                                retRecs.append(R)
                                break
                        except AttributeError:
                            pass
                elif field == 'P':
                    for cite in R.get('citations'):
                        try:
                            if keyString.upper() in cite.P:
                                retRecs.append(R)
                                break
                        except AttributeError:
                            pass
                elif field == 'misc':
                    for cite in R.get('citations'):
                        try:
                            if keyString.upper() in cite.misc:
                                retRecs.append(R)
                                break
                        except AttributeError:
                            pass
                elif field == 'anonymous':
                    for cite in R.get('citations'):
                        if cite.isAnonymous():
                            retRecs.append(R)
                            break
                elif field == 'bad':
                    for cite in R.get('citations'):
                        if cite.bad:
                            retRecs.append(R)
                            break
            except TypeError:
                pass
        if reverse:
            excluded = []
            for R in self:
                if R not in retRecs:
                    excluded.append(R)
            return RecordCollection(inCollection = excluded, name = self.name, quietStart = True)
        else:
            return RecordCollection(inCollection = retRecs, name = self.name, quietStart = True)