import math


def acose(x):
    """
    Custom implementation of numpy.acose
    Returns either 0 or math.pi if input value out of [-1, 1]
    """
    result = 0.0
    if x > 1:
        result = 0
    elif x < -1:
        result = math.pi
    else:
        result = math.acos(x)
    return result