def alias(a, b):
    """Check whether the arrays `a` and `b` alias."""

    if a is b:
        return True
    elif a.base is None and b.base is None:
        return False
    else:
        return a.base is b or a is b.base or a.base is b.base