Return the nearest integer to x, rounding halfway cases *away from zero*.

    If the result is not exactly representable, it will be rounded according to
    the current context.

    .. note::

       This function corresponds to the MPFR function ``mpfr_rint_round``, not
       to ``mpfr_round``.

def round(x, context=None):
    """
    Return the nearest integer to x, rounding halfway cases *away from zero*.

    If the result is not exactly representable, it will be rounded according to
    the current context.

    .. note::

       This function corresponds to the MPFR function ``mpfr_rint_round``, not
       to ``mpfr_round``.

    """
    return _apply_function_in_current_context(
        BigFloat,
        mpfr.mpfr_rint_round,
        (BigFloat._implicit_convert(x),),
        context,
    )