<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ekbseg(handle, tabnam, cnames, decls):
 """ Start a new segment in an E-kernel. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ekbseg_c.html :param handle: File handle. :type handle: int :param tabnam: Table name. :type tabnam: str :param cnames: Names of columns. :type cnames: list of str. :param decls: Declarations of columns. :type decls: list of str. :return: Segment number. :rtype: int """

    handle = ctypes.c_int(handle)
    tabnam = stypes.stringToCharP(tabnam)
    ncols  = ctypes.c_int(len(cnames))
    cnmlen = ctypes.c_int(len(max(cnames, key=len)) + 1) # needs to be len(name)+1 ie 'c1' to 3 for ekbseg do not fail
    cnames = stypes.listToCharArrayPtr(cnames)
    declen = ctypes.c_int(len(max(decls, key=len)) + 1)
    decls = stypes.listToCharArrayPtr(decls)
    segno = ctypes.c_int()
    libspice.ekbseg_c(handle, tabnam, ncols, cnmlen, cnames, declen, decls, ctypes.byref(segno))
    return segno.value