<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def erfinv(z):
 """ Calculate the inverse error function at point ``z``. This is a direct port of the SciPy ``erfinv`` function, originally written in C. Parameters z : numeric Returns ------- float References + https://en.wikipedia.org/wiki/Error_function#Inverse_functions + http://functions.wolfram.com/GammaBetaErf/InverseErf/ Examples -------- 0.088855990494 0.476936276204 -0.476936276204 1.38590382435 0.3 0.5 0 inf -inf """

    if abs(z) > 1:
        raise ValueError("`z` must be between -1 and 1 inclusive")

    # Shortcut special cases
    if z == 0:
        return 0
    if z == 1:
        return inf
    if z == -1:
        return -inf

    # otherwise calculate things.
    return _ndtri((z + 1) / 2.0) / math.sqrt(2)