def _module_info_from_proto_safe(module_info_def, import_scope=None):
  """Deserializes the `module_info_def` proto without raising exceptions.

  Args:
    module_info_def: An instance of `module_pb2.SonnetModule`.
    import_scope: Optional `string`. Name scope to use.

  Returns:
    An instance of `ModuleInfo`.
  """
  try:
    return _module_info_from_proto(module_info_def, import_scope)
  except Exception as e:  # pylint: disable=broad-except
    logging.warning(
        "Error encountered when deserializing sonnet ModuleInfo:\n%s", str(e))
    return None