def ends_overlap(left, right):
    """Returns whether the left ends with one of the non-empty prefixes of the right"""
    for i in range(1, min(len(left), len(right)) + 1):
        if left.endswith(right[:i]):
            return True

    return False