DRY code for joining comments together and conditionally adding a period at
    the end, and adding this comment string to the state return dict.

def _format_comments(ret, comments):
    '''
    DRY code for joining comments together and conditionally adding a period at
    the end, and adding this comment string to the state return dict.
    '''
    if isinstance(comments, six.string_types):
        ret['comment'] = comments
    else:
        ret['comment'] = '. '.join(comments)
        if len(comments) > 1:
            ret['comment'] += '.'
    return ret