class BeaconStateUtil {

  public static UInt64 get_previous_epoch(BeaconState state) {
    UInt64 current_epoch = get_current_epoch(state);
    return current_epoch.equals(UInt64.valueOf(GENESIS_EPOCH))
        ? UInt64.valueOf(GENESIS_EPOCH)
        : current_epoch.minus(UInt64.ONE);
  }

}