<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def compatible_names(e1, e2):
 """This function takes either PartitionParts or Mentions as arguments """


    if e1.ln() != e2.ln():
        return False

    short, long = list(e1.mns()), e2.mns()
    if len(short) > len(long):
        return compatible_names(e2, e1)

    # the front first names must be compatible
    if not compatible_name_part(e1.fn(), e2.fn()):
        return False

    # try finding each middle name of long in short, and remove the
    # middle name from short if found
    for wl in long:
        if not short:
            break
        ws = short.pop(0)
        if not compatible_name_part(ws, wl):
            short.insert(0, ws)

    # true iff short is a compatible substring of long
    return short == []