<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cmp(op1, op2):
 """ Perform a three-way comparison of op1 and op2. Return a positive value if op1 > op2, zero if op1 = op2, and a negative value if op1 < op2. Both op1 and op2 are considered to their full own precision, which may differ. If one of the operands is NaN, raise ValueError. Note: This function may be useful to distinguish the three possible cases. If you need to distinguish two cases only, it is recommended to use the predicate functions like 'greaterequal'; they behave like the IEEE 754 comparisons, in particular when one or both arguments are NaN. """

    op1 = BigFloat._implicit_convert(op1)
    op2 = BigFloat._implicit_convert(op2)
    if is_nan(op1) or is_nan(op2):
        raise ValueError("Cannot perform comparison with NaN.")
    return mpfr.mpfr_cmp(op1, op2)