<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def punctuate(current_text, new_text, add_punctuation):
 """ Add punctuation as needed """

    if add_punctuation and current_text and not current_text[-1] in string.punctuation:
        current_text += '. '
    spacer = ' ' if not current_text or (not current_text[-1].isspace() and not new_text[0].isspace()) else ''
    return current_text + spacer + new_text