<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def discover() -> List[Tuple[str, str]]: """ Scan for connected modules and instantiate handler classes """

    if IS_ROBOT and os.path.isdir('/dev/modules'):
        devices = os.listdir('/dev/modules')
    else:
        devices = []

    discovered_modules = []

    module_port_regex = re.compile('|'.join(MODULE_TYPES.keys()), re.I)
    for port in devices:
        match = module_port_regex.search(port)
        if match:
            name = match.group().lower()
            if name not in MODULE_TYPES:
                log.warning("Unexpected module connected: {} on {}"
                            .format(name, port))
                continue
            absolute_port = '/dev/modules/{}'.format(port)
            discovered_modules.append((absolute_port, name))
    log.info('Discovered modules: {}'.format(discovered_modules))

    return discovered_modules