code: func NewHandle(app string, ds datastore.DataStore, id string, numElements uint64) (*Handle, error) {
  	h := &Handle{
  		app:        app,
  		id:         id,
  		store:      ds,
  		bits:       numElements,
  		unselected: numElements,
  		head: &sequence{
  			block: 0x0,
  			count: getNumBlocks(numElements),
  		},
  	}
  
  	if h.store == nil {
  		return h, nil
  	}
  
  	// Get the initial status from the ds if present.
  	if err := h.store.GetObject(datastore.Key(h.Key()...), h); err != nil && err != datastore.ErrKeyNotFound {
  		return nil, err
  	}
  
  	// If the handle is not in store, write it.
  	if !h.Exists() {
  		if err := h.writeToStore(); err != nil {
  			return nil, fmt.Errorf("failed to write bitsequence to store: %v", err)
  		}
  	}
  
  	return h, nil
  }
docs: // NewHandle returns a thread-safe instance of the bitmask handler