<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def root(x, k, context=None):
 """ Return the kth root of x. For k odd and x negative (including -Inf), return a negative number. For k even and x negative (including -Inf), return NaN. The kth root of -0 is defined to be -0, whatever the parity of k. This function is only implemented for nonnegative k. """

    if k < 0:
        raise ValueError("root function not implemented for negative k")

    return _apply_function_in_current_context(
        BigFloat,
        mpfr.mpfr_root,
        (BigFloat._implicit_convert(x), k),
        context,
    )