<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _character_matches(name1, name2):
 """Yield the number of characters that match the beginning of each string. """

    if name1[0] == "*":
        for i in range(len(name2) + 1):
            yield 1, i
    if name2[0] == "*":
        for i in range(len(name1) + 1):
            yield i, 1
    if name1[0] == name2[0]:
        yield 1, 1