code: def cell_from_spec(cell_classname, cell_params):
      """Create a RNN Cell instance from a JSON string.
  
      Args:
        cell_classname: Name of the cell class, e.g. "BasicLSTMCell".
        cell_params: A dictionary of parameters to pass to the cell constructor.
  
      Returns:
        A RNNCell instance.
      """
  
      cell_params = cell_params.copy()
  
      # Find the cell class
      cell_class = locate(cell_classname) or getattr(
          rnn_cell, cell_classname
      )
  
      # Make sure additional arguments are valid
      cell_args = set(inspect.getargspec(cell_class.__init__).args[1:])
      for key in cell_params.keys():
          if key not in cell_args:
              raise ValueError(
                  """{} is not a valid argument for {} class. Available arguments
            are: {}""".format(
                      key, cell_class.__name__, cell_args
                  )
              )
  
      # Create cell
      return cell_class(**cell_params)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import inspect
  import os
  from collections import defaultdict
  from pydoc import locate
  import json
  import tensorflow
  from tensorflow import gfile
  from seq2seq.contrib import rnn_cell
label_desc: Use image node_id 1 for calling a global function with example usage: cell_from_spec(cell_classname, cell_params) and returns: cell_class