def consistent(old, new):
    """
    Asserts that either first argument is None or
    both arguments are equal, and returns the non-None
    argument.
    """
    if old is None:
        return new
    assert old == new
    return old
