def _create_carefully(path):
    fd = os.open(path, os.O_CREAT | os.O_EXCL | os.O_RDWR)
    try:
        return open(path, 'rb+')
    finally:
        os.close(fd)
Create a file if it doesn't exist and open for reading and writing.
dataset/ETHPy150Open babble/babble/include/jython/Lib/mailbox.py/_create_carefully