def fn2lun(fname):
    """
    Internal undocumented command for mapping name of open file to
    its FORTRAN (F2C) logical unit.

    https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/fn2lun.html

    :param fname: name of the file to be mapped to its logical unit.
    :type fname: str
    :return: the FORTRAN (F2C) logical unit associated with the filename.
    :rtype: int
    """
    fnameP    = stypes.stringToCharP(fname)
    unit_out  = ctypes.c_int()
    fname_len = ctypes.c_int(len(fname)+1)
    libspice.fn2lun_(fnameP,ctypes.byref(unit_out),fname_len)
    return unit_out.value