we should not output before_tag + after_tag when remain_depth == 0, so

    return '' if remain_depth <= 0

is better