<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def orderc(array, ndim=None):
 """ Determine the order of elements in an array of character strings. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/orderc_c.html :param array: Input array. :type array: Array of strings. :param ndim: Optional Length of input array :type ndim: int :return: Order vector for array. :rtype: array of ints """

    if ndim is None:
        ndim = ctypes.c_int(len(array))
    else:
        ndim = ctypes.c_int(ndim)
    lenvals = ctypes.c_int(len(max(array, key=len)) + 1)
    iorder = stypes.emptyIntVector(ndim)
    array = stypes.listToCharArray(array, lenvals, ndim)
    libspice.orderc_c(lenvals, array, ndim, iorder)
    return stypes.cVectorToPython(iorder)