def METHOD_NAME(self, document):
    this = doc = document
    if self.doc:
        exec(self.expand_eval_code(self.doc))
    if self.bundle or self.before_bundle or self.after_bundle or self.tree or self.node:
        for bundle in doc.bundles:
            # TODO if self._should_process_bundle(bundle):
            self.process_bundle(bundle)
    if self.coref_entity or self.coref_mention:
        for entity in doc.coref_entities:
            if self.coref_entity:
                this = entity
                exec(self.expand_eval_code(self.coref_entity))
            if self.coref_mention:
                for mention in entity.mentions:
                    this = mention
                    exec(self.expand_eval_code(self.coref_mention))