<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def concatenate_matches(a, b, text, name):
 """Concatenate matches a and b. All submatches will be copied to result."""

    match = Match(a.start, b.end, text[a.start:b.end], name)
    for k, v in a.matches.items():
        match.matches[k] = v
    for k, v in b.matches.items():
        match.matches[k] = v
    if a.name is not None:
        aa = copy(a)
        del aa[MATCHES]
        match.matches[a.name] = aa
    if b.name is not None:
        bb = copy(b)
        del bb[MATCHES]
        match.matches[b.name] = bb
    return match