@staticmethod
    def ocfn(filename, openMode = 'r+'):
        """Atomically open or create file from filename.

           If file already exists, Then open file using openMode
           Else create file using write update mode
           Returns file object
        """
        try:
            newfd = os.open(filename, os.O_EXCL | os.O_CREAT | os.O_RDWR, 436) # 436 == octal 0664
            newfile = os.fdopen(newfd, openMode)
        except __HOLE__ as ex:
            if ex.errno == errno.EEXIST:
                newfile = open(filename, openMode)
            else:
                raise
        return newfile
dataset/ETHPy150Open ioflo/ioflo/ioflo/aid/consoling.py/Console.ocfn