func: function _subscriptionState(Subscription storage sub) internal constant returns(SubState status) {
          if (!_isSubscription(sub)) {
              return SubState.NOT_EXIST;
          } else if (sub.startOn > now) {
              return SubState.BEFORE_START;
          } else if (sub.onHoldSince > 0) {
              return SubState.ON_HOLD;
          } else if (sub.paidUntil >= sub.expireOn) {
              return now < sub.expireOn
                  ? SubState.CANCELED
                  : sub.depositAmount > 0
                      ? SubState.EXPIRED
                      : SubState.FINALIZED;
          } else if (sub.paidUntil <= now) {
              return SubState.CHARGEABLE;
          } else {
              return SubState.PAID;
          }
      }