<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def nts(s, encoding, errors):
 """Convert a null-terminated bytes object to a string. """

    p = s.find(b"\0")
    if p != -1:
        s = s[:p]
    return s.decode(encoding, errors)