<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rejoin(string, separator_regexp=None, spaced=False):
 """Split a string and then rejoin it Spaces are interspersed between items only if spaced is True 'fred,was,here' """

    strings = split_and_strip(string)
    if separator_regexp is None:
        separator_regexp = _default_separator()
    joiner = spaced and '%s ' % separator_regexp or separator_regexp
    return joiner.join(strings)