code: func (s *State) DeepCopy() *State {
  	if s == nil {
  		return nil
  	}
  
  	modules := make(map[string]*Module, len(s.Modules))
  	for k, m := range s.Modules {
  		modules[k] = m.DeepCopy()
  	}
  	return &State{
  		Modules: modules,
  	}
  }
docs: // Taking deep copies of states is an important operation because state is
  // otherwise a mutable data structure that is challenging to share across
  // many separate callers. It is important that the DeepCopy implementations
  // in this file comprehensively copy all parts of the state data structure
  // that could be mutated via pointers.
  // DeepCopy returns a new state that contains equivalent data to the reciever
  // but shares no backing memory in common.
  //
  // As with all methods on State, this method is not safe to use concurrently
  // with writing to any portion of the recieving data structure. It is the
  // caller's responsibility to ensure mutual exclusion for the duration of the
  // operation, but may then freely modify the receiver and the returned copy
  // independently once this method returns.