def def_match(part, varsets):
    matched = False
    for varset in varsets:
        if matched:
            break
        if (part in varset):
            defs = varset[part]
            for (pattern, definition) in defs:
                if matched:
                    break
                if (part == definition):
                    continue
                if (pattern is None):
                    definition = copy(definition)
                    if isinstance(definition, tuple):
                        definition = list(definition)
                    return (True, definition)
    return (False, None)
def def_match(part, varsets):
    matched = False
    for varset in varsets:
        if matched:
            break
        if (part in varset):
            defs = varset[part]
            for (pattern, definition) in defs:
                if matched:
                    break
                if (part == definition):
                    continue
                if (pattern is None):
                    definition = copy(definition)
                    if isinstance(definition, tuple):
                        definition = list(definition)
                    return (True, definition)
    return (False, None)