def filter(self, *args, **kwargs):
        """
        This predates the core generic model filtering utilities, so it does
        a bunch of stuff that is not best practice but is preserved here for
        backward compatibility. The ``jobs.filter`` event is now deprecated
        and will be removed in the next major release in favor of the normal
        ``exposeFields`` et al.
        """
        if 'job' in kwargs:
            args = [kwargs.pop('folder')] + list(args)

        job = args[0]

        if 'user' in kwargs:
            user = kwargs.pop('user')
        else:
            user = args[1]

        # Allow downstreams to filter job info as they see fit
        event = events.trigger('jobs.filter', info={
            'job': job,
            'user': user
        })

        keys = []

        if 'additionalKeys' in kwargs:
            keys.extend(kwargs.pop('additionalKeys'))

        removeFields = set()
        for resp in event.responses:
            if 'exposeFields' in resp:
                keys.extend(resp['exposeFields'])
            if 'removeFields' in resp:
                removeFields |= set(resp['removeFields'])

        doc = super(Job, self).filter(job, user, additionalKeys=keys, **kwargs)

        if 'kwargs' in doc and isinstance(doc['kwargs'], six.string_types):
            doc['kwargs'] = json_util.loads(doc['kwargs'])

        for field in removeFields:
            if field in doc:
                del doc[field]

        return doc
dataset/ETHPy150Open girder/girder/plugins/jobs/server/models/job.py/Job.filter/original