code: public static PStatus toProto(Status status) {
      switch (status.getCode()) {
        case ABORTED:
          return PStatus.ABORTED;
        case ALREADY_EXISTS:
          return PStatus.ALREADY_EXISTS;
        case CANCELLED:
          return PStatus.CANCELED;
        case DATA_LOSS:
          return PStatus.DATA_LOSS;
        case DEADLINE_EXCEEDED:
          return PStatus.DEADLINE_EXCEEDED;
        case FAILED_PRECONDITION:
          return PStatus.FAILED_PRECONDITION;
        case INTERNAL:
          return PStatus.INTERNAL;
        case INVALID_ARGUMENT:
          return PStatus.INVALID_ARGUMENT;
        case NOT_FOUND:
          return PStatus.NOT_FOUND;
        case OK:
          return PStatus.OK;
        case OUT_OF_RANGE:
          return PStatus.OUT_OF_RANGE;
        case PERMISSION_DENIED:
          return PStatus.PERMISSION_DENIED;
        case RESOURCE_EXHAUSTED:
          return PStatus.RESOURCE_EXHAUSTED;
        case UNAUTHENTICATED:
          return PStatus.UNAUTHENTICATED;
        case UNAVAILABLE:
          return PStatus.UNAVAILABLE;
        case UNIMPLEMENTED:
          return PStatus.UNIMPLEMENTED;
        case UNKNOWN:
          return PStatus.UNKNOWN;
        default:
          return PStatus.UNKNOWN;
      }
    }
docs: Converts an internal exception status to a protocol buffer type status.
  
  @param status the status to convert
  @return the protocol buffer type status