class_docstr: Abstraction of a NLU pipeline unit
  
  Pipeline processing units such as intent parsers, intent classifiers and
  slot fillers must implement this class.
  
   A :class:`ProcessingUnit` is associated with a *config_type*, which
  represents the :class:`.ProcessingUnitConfig` used to initialize it.
docstr: Serialize the :class:`ProcessingUnit` instance into a bytearray
  
  This method persists the processing unit in a temporary directory, zip
  the directory and return the zipped file as binary data.
  
  Returns:
      bytearray: the processing unit as bytearray data
docstr_tok: ["Serialize","the",":","class",":","`","ProcessingUnit","`","instance","into","a","bytearray","This","method","persists","the","processing","unit","in","a","temporary","directory",",","zip","the","directory","and","return","the","zipped","file","as","binary","data",".","Returns",":","bytearray",":","the","processing","unit","as","bytearray","data"]
code: def to_byte_array(self):
      """Serialize the :class:`ProcessingUnit` instance into a bytearray
  
      This method persists the processing unit in a temporary directory, zip
      the directory and return the zipped file as binary data.
  
      Returns:
          bytearray: the processing unit as bytearray data
      """
      cleaned_unit_name = _sanitize_unit_name(self.unit_name)
      with temp_dir() as tmp_dir:
          processing_unit_dir = tmp_dir / cleaned_unit_name
          self.persist(processing_unit_dir)
          archive_base_name = tmp_dir / cleaned_unit_name
          archive_name = archive_base_name.with_suffix(".zip")
          shutil.make_archive(
              base_name=str(archive_base_name),
              format="zip",
              root_dir=str(tmp_dir),
              base_dir=cleaned_unit_name,
          )
          with archive_name.open(mode="rb") as f:
              processing_unit_bytes = bytearray(f.read())
      return processing_unit_bytes
  
imports: from __future__ import unicode_literals
  import io
  import json
  import shutil
  from abc import ABCMeta, abstractmethod, abstractproperty
  from builtins import str, bytes
  from pathlib import Path
  from future.utils import with_metaclass
  from snips_nlu.common.abc_utils import abstractclassmethod, classproperty
  from snips_nlu.common.io_utils import temp_dir, unzip_archive
  from snips_nlu.common.registrable import Registrable
  from snips_nlu.common.utils import json_string, check_random_state
  from snips_nlu.constants import BUILTIN_ENTITY_PARSER, CUSTOM_ENTITY_PARSER, CUSTOM_ENTITY_PARSER_USAGE, RESOURCES, LANGUAGE, RANDOM_STATE
  from snips_nlu.entity_parser import BuiltinEntityParser, CustomEntityParser, CustomEntityParserUsage
  from snips_nlu.exceptions import LoadingError
  from snips_nlu.pipeline.configs import ProcessingUnitConfig
  from snips_nlu.pipeline.configs.config import DefaultProcessingUnitConfig
  from snips_nlu.resources import load_resources
label_desc: Use image node_id 15 for calling the ProcessingUnit obj's underlying member method code with example usage: obj.to_byte_array() and returns: processing_unit_bytes