<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dropNonJournals(self, ptVal = 'J', dropBad = True, invert = False):
 """Drops the non journal type `Records` from the collection, this is done by checking _ptVal_ against the PT tag # Parameters _ptVal_ : `optional [str]` > Default `'J'`, The value of the PT tag to be kept, default is `'J'` the journal tag, other tags can be substituted. _dropBad_ : `optional [bool]` > Default `True`, if `True` bad `Records` will be dropped as well those that are not journal entries _invert_ : `optional [bool]` > Default `False`, Set `True` to drop journals (or the PT tag given by _ptVal_) instead of keeping them. **Note**, it still drops bad Records if _dropBad_ is `True` """

        if dropBad:
            self.dropBadEntries()
        if invert:
            self._collection = {r for r in self._collection if r['pubType'] != ptVal.upper()}
        else:
            self._collection = {r for r in self._collection if r['pubType'] == ptVal.upper()}