def mkfile(self, objects):
        file_path = self.mktemp()
        file_obj = open(file_path, 'w')
        for obj_type, seq in objects.iteritems():
            for obj in seq:
                if self.status:
                    file_obj.write("%sstatus {\n" % obj_type)
                else:
                   file_obj.write("define %s {\n" % obj_type)
                for attr, value in obj.iteritems():
                    value = self.escape(value)
                    if self.status:
                        file_obj.write("    %s=%s\n" % (attr, value))
                    else:
                        file_obj.write("    %s %s\n" % (attr, value))
                file_obj.write("    }\n")
        file_obj.close()
        return file_path
dataset/ETHPy150Open marineam/nagcat/python/nagcat/unittests/test_nagios_objects.py/ObjectsPyTestCase.mkfile/original