code: def _module_info_from_proto(module_info_def, import_scope=None):
    
    graph = tf.get_default_graph()
    def prepend_name_scope(name_scope):
      return ops.prepend_name_scope(name_scope, import_scope)
    def process_leafs(name):
      return _path_to_graph_element(prepend_name_scope(name), graph)
    connected_subgraphs = []
    module_info = ModuleInfo(
        module_name=module_info_def.module_name,
        scope_name=prepend_name_scope(module_info_def.scope_name),
        class_name=module_info_def.class_name,
        connected_subgraphs=connected_subgraphs)
    for connected_subgraph_def in module_info_def.connected_subgraphs:
      connected_subgraph = ConnectedSubGraph(
          module=module_info,
          name_scope=prepend_name_scope(connected_subgraph_def.name_scope),
          inputs=_nested_from_proto(
              connected_subgraph_def.inputs, process_leafs),
          outputs=_nested_from_proto(
              connected_subgraph_def.outputs, process_leafs))
      connected_subgraphs.append(connected_subgraph)
    return module_info
docs: Deserializes `module_info_def` proto.
  
    Args:
      module_info_def: An instance of `module_pb2.SonnetModule`.
      import_scope: Optional `string`. Name scope to use.
  
    Returns:
      An instance of `ModuleInfo`.
  
    Raises:
      base_errors.ModuleInfoError: If the probobuf is of the wrong type or
        if some of its fields are missing.