code: def _nyoka_rule(
      self, simple_rule: models.SimpleRule
  ) -> nyoka_pmml.SimpleRule:
      return nyoka_pmml.SimpleRule(
          SimplePredicate=None
          if (
              simple_rule.predicate is None
              or not isinstance(
                  simple_rule.predicate, models.SimplePredicate
              )
          )
          else nyoka_pmml.SimplePredicate(
              field=simple_rule.predicate.field,
              operator=simple_rule.predicate.operator.name,
              value=simple_rule.predicate.value,
          ),
          CompoundPredicate=None
          if (
              simple_rule.predicate is None
              or not isinstance(
                  simple_rule.predicate, models.CompoundPredicate
              )
          )
          else nyoka_pmml.CompoundPredicate(
              booleanOperator=simple_rule.predicate.booleanOperator.name,
              SimplePredicate=[
                  nyoka_pmml.SimplePredicate(
                      field=sp.field,
                      operator=sp.operator.name,
                      value=sp.value,
                  )
                  for sp in simple_rule.predicate.simplePredicates
              ],
          ),
          score=simple_rule.score,
          id=simple_rule.id,
          recordCount=simple_rule.recordCount,
          nbCorrect=simple_rule.nbCorrect,
          confidence=simple_rule.confidence,
          weight=simple_rule.weight,
      )
  
imports: import typing
  import datetime
  import io
  import nyoka.PMML44
  import nyoka.base.constants
  from .abstract_serializer import AbstractSerializer
  from ..None import __version__
  from ..None import models
label_desc: Use image node_id 9 for calling the NyokaSerializer obj's underlying member method code with example usage: obj._nyoka_rule(simple_rule) and returns: nyoka_pmml