<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def spkw09(handle, body, center, inframe, first, last, segid, degree, n, states, epochs):
 """ Write a type 9 segment to an SPK file. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkw09_c.html :param handle: Handle of an SPK file open for writing. :type handle: int :param body: NAIF code for an ephemeris object. :type body: int :param center: NAIF code for center of motion of "body". :type center: int :param inframe: Reference frame name. :type inframe: str :param first: Start time of interval covered by segment. :type first: float :param last: End time of interval covered by segment. :type last: float :param segid: Segment identifier. :type segid: str :param degree: Degree of interpolating polynomials. :type degree: int :param n: Number of states. :type n: int :param states: Array of states. :type states: Nx6-Element Array of floats :param epochs: Array of epochs corresponding to states. :type epochs: Array of floats """

    handle = ctypes.c_int(handle)
    body = ctypes.c_int(body)
    center = ctypes.c_int(center)
    inframe = stypes.stringToCharP(inframe)
    first = ctypes.c_double(first)
    last = ctypes.c_double(last)
    segid = stypes.stringToCharP(segid)
    degree = ctypes.c_int(degree)
    n = ctypes.c_int(n)
    states = stypes.toDoubleMatrix(states)  # X by 6 array
    epochs = stypes.toDoubleVector(epochs)
    libspice.spkw09_c(handle, body, center, inframe, first, last, segid, degree,
                      n, states, epochs)