<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def spkw20(handle, body, center, inframe, first, last, segid, intlen, n, polydg, cdata, dscale, tscale, initjd, initfr):
 """ Write a type 20 segment to an SPK file. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/spkw20_c.html :param handle: Handle of an SPK file open for writing. :type handle: int :param body: Body code for ephemeris object. :type body: int :param center: Body code for the center of motion of the body. :type center: int :param inframe: The reference frame of the states. :type inframe: str :param first: First valid time for which states can be computed. :type first: float :param last: Last valid time for which states can be computed. :type last: float :param segid: Segment identifier. :type segid: str :param intlen: Length of time covered by logical record (days). :param n: Number of logical records in segment. :param polydg: Chebyshev polynomial degree. :param cdata: Array of Chebyshev coefficients and positions. :param dscale: Distance scale of data. :param tscale: Time scale of data. :param initjd: Integer part of begin time (TDB Julian date) of first record. :param initfr: Fractional part of begin time (TDB Julian date) of first record. """

    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)
    intlen  = ctypes.c_double(intlen)
    n       = ctypes.c_int(n)
    polydg  = ctypes.c_int(polydg)
    cdata   = stypes.toDoubleVector(cdata)
    dscale  = ctypes.c_double(dscale)
    tscale  = ctypes.c_double(tscale)
    initjd  = ctypes.c_double(initjd)
    initfr  = ctypes.c_double(initfr)
    libspice.spkw20_c(handle, body, center, inframe, first, last, segid, intlen, n, polydg, cdata, dscale, tscale, initjd, initfr)