<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_attached_instruments( self, expected: Dict[types.Mount, str])\ -> Dict[types.Mount, Dict[str, Optional[str]]]: """ Update the internal cache of attached instruments. This method allows after-init-time specification of attached simulated instruments. The method will return - the instruments specified at init-time, or if those do not exists, - the instruments specified in expected, or if that is not passed, - nothing :param expected: A mapping of mount to instrument model prefixes. When loading instruments from a prefix, we return the lexically-first model that matches the prefix. If the models specified in expected do not match the models specified in the `attached_instruments` argument of :py:meth:`__init__`, :py:attr:`RuntimeError` is raised. :raises RuntimeError: If an instrument is expected but not found. :returns: A dict of mount to either instrument model names or `None`. """

        to_return: Dict[types.Mount, Dict[str, Optional[str]]] = {}
        for mount in types.Mount:
            expected_instr = expected.get(mount, None)
            init_instr = self._attached_instruments.get(mount, {})
            found_model = init_instr.get('model', '')
            if expected_instr and found_model\
                    and not found_model.startswith(expected_instr):
                if self._strict_attached:
                    raise RuntimeError(
                        'mount {}: expected instrument {} but got {}'
                        .format(mount.name, expected_instr, init_instr))
                else:
                    to_return[mount] = {
                        'model': find_config(expected_instr),
                        'id': None}
            elif found_model and expected_instr:
                # Instrument detected matches instrument expected (note:
                # "instrument detected" means passed as an argument to the
                # constructor of this class)
                to_return[mount] = init_instr
            elif found_model:
                # Instrument detected and no expected instrument specified
                to_return[mount] = init_instr
            elif expected_instr:
                # Expected instrument specified and no instrument detected
                to_return[mount] = {
                    'model': find_config(expected_instr),
                    'id': None}
            else:
                # No instrument detected or expected
                to_return[mount] = {
                    'model': None,
                    'id': None}
        return to_return