<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_object(self, nidm_object, export_file=True):
 """ Add a NIDMObject to a NIDM-Results export. """

        if not export_file:
            export_dir = None
        else:
            export_dir = self.export_dir

        if not isinstance(nidm_object, NIDMFile):
            nidm_object.export(self.version, export_dir)
        else:
            nidm_object.export(self.version, export_dir, self.prepend_path)
        # ProvDocument: add object to the bundle
        if nidm_object.prov_type == PROV['Activity']:
            self.bundle.activity(nidm_object.id,
                                 other_attributes=nidm_object.attributes)
        elif nidm_object.prov_type == PROV['Entity']:
            self.bundle.entity(nidm_object.id,
                               other_attributes=nidm_object.attributes)
        elif nidm_object.prov_type == PROV['Agent']:
            self.bundle.agent(nidm_object.id,
                              other_attributes=nidm_object.attributes)