<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def txtopn(fname):
 """ Internal undocumented command for opening a new text file for subsequent write access. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ftncls_c.html#Files https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ftncls_c.html#Examples :param fname: name of the new text file to be opened. :type fname: str :return: FORTRAN logical unit of opened file :rtype: int """

    fnameP    = stypes.stringToCharP(fname)
    unit_out  = ctypes.c_int()
    fname_len = ctypes.c_int(len(fname))
    libspice.txtopn_(fnameP, ctypes.byref(unit_out), fname_len)
    return unit_out.value