code: def structure_attrs_fromdict(self, obj, cl):
          # type: (Mapping[str, Any], Type[T]) -> T
          
          # For public use.
          conv_obj = {}  # Start with a fresh dict, to ignore extra keys.
          dispatch = self._structure_func.dispatch
          for a in cl.__attrs_attrs__:  # type: ignore
              # We detect the type by metadata.
              type_ = a.type
              name = a.name
  
              try:
                  val = obj[name]
              except KeyError:
                  continue
  
              if name[0] == "_":
                  name = name[1:]
  
              conv_obj[name] = (
                  dispatch(type_)(val, type_) if type_ is not None else val
              )
  
          return cl(**conv_obj)
docs: Instantiate an attrs class from a mapping (dict).