<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def open_fd(cls, name):
 """Open a file or create it."""

        # Try to create it, if can't, try to open.
        try:
            return os.open(name, os.O_CREAT | os.O_RDWR | os.O_EXCL)
        except OSError as e:
            if e.errno != errno.EEXIST:
                raise
            return os.open(name, os.O_RDWR | os.O_EXCL)