def need_new_build(current_build, new_target):
    """
    Returns true if we need a new build, false if not

    If the current build is empty, we definitely do not need a new
    build.

    If we've already seen a target name in the build, then the new
    target is from a different build.

    If the ending time of the new target is earlier than the latest
    target in the current build, then the new target is also from a
    different build.
    """
    if not current_build.targets:
        return False
    if new_target in current_build:
        return True
    return new_target.end < current_build.targets[-1].end