code: def _structure_union(self, obj, union):
          
          # Unions with NoneType in them are basically optionals.
          # We check for NoneType early and handle the case of obj being None,
          # so disambiguation functions don't need to handle NoneType.
          union_params = union.__args__
          if NoneType in union_params:  # type: ignore
              if obj is None:
                  return None
              if len(union_params) == 2:
                  # This is just a NoneType and something else.
                  other = (
                      union_params[0]
                      if union_params[1] is NoneType  # type: ignore
                      else union_params[1]
                  )
                  # We can't actually have a Union of a Union, so this is safe.
                  return self._structure_func.dispatch(other)(obj, other)
  
          # Check the union registry first.
          handler = self._union_registry.get(union)
          if handler is not None:
              return handler(obj, union)
  
          # Getting here means either this is not an optional, or it's an
          # optional with more than one parameter.
          # Let's support only unions of attr classes for now.
          cl = self._dis_func_cache(union)(obj)
          return self._structure_func.dispatch(cl)(obj, cl)
docs: Deal with converting a union.