code: func (b *Backend) StateMgr(name string) (state.State, error) {
  	c, err := b.client(name)
  	if err != nil {
  		return nil, err
  	}
  
  	st := &remote.State{Client: c}
  
  	// Grab the value
  	if err := st.RefreshState(); err != nil {
  		return nil, err
  	}
  
  	// If we have no state, we have to create an empty state
  	if v := st.State(); v == nil {
  
  		lockInfo := state.NewLockInfo()
  		lockInfo.Operation = "init"
  		lockID, err := st.Lock(lockInfo)
  		if err != nil {
  			return nil, err
  		}
  
  		// Local helper function so we can call it multiple places
  		unlock := func(baseErr error) error {
  			if err := st.Unlock(lockID); err != nil {
  				const unlockErrMsg = `%v
  				Additionally, unlocking the state file on Google Cloud Storage failed:
  
  				Error message: %q
  				Lock ID (gen): %v
  				Lock file URL: %v
  
  				You may have to force-unlock this state in order to use it again.
  				The GCloud backend acquires a lock during initialization to ensure
  				the initial state file is created.`
  				return fmt.Errorf(unlockErrMsg, baseErr, err.Error(), lockID, c.lockFileURL())
  			}
  
  			return baseErr
  		}
  
  		if err := st.WriteState(states.NewState()); err != nil {
  			return nil, unlock(err)
  		}
  		if err := st.PersistState(); err != nil {
  			return nil, unlock(err)
  		}
  
  		// Unlock, the state should now be initialized
  		if err := unlock(nil); err != nil {
  			return nil, err
  		}
  
  	}
  
  	return st, nil
  }
docs: // StateMgr reads and returns the named state from GCS. If the named state does
  // not yet exist, a new state file is created.