class_docstr: Represents a parameter dictionary with a history, and contains other functionality around
  parameter passing and validation for AllenNLP.
  
  There are currently two benefits of a ``Params`` object over a plain dictionary for parameter
  passing:
  
  #. We handle a few kinds of parameter validation, including making sure that parameters
     representing discrete choices actually have acceptable values, and making sure no extra
     parameters are passed.
  #. We log all parameter reads, including default values.  This gives a more complete
     specification of the actual parameters used than is given in a JSON file, because
     those may not specify what default values were used, whereas this will log them.
  
  The convention for using a ``Params`` object in AllenNLP is that you will consume the parameters
  as you read them, so that there are none left when you've read everything you expect.  This
  lets us easily validate that you didn't pass in any `extra` parameters, just by making sure
  that the parameter dictionary is empty.  You should do this when you're done handling
  parameters, by calling :func:`Params.assert_empty`.
docstr: Gets the value of ``key`` in the ``params`` dictionary, ensuring that the value is one of
  the given choices. Note that this `pops` the key from params, modifying the dictionary,
  consistent with how parameters are processed in this codebase.
  
  Parameters
  ----------
  key: str
      Key to get the value from in the param dictionary
  choices: List[Any]
      A list of valid options for values corresponding to ``key``.  For example, if you're
      specifying the type of encoder to use for some part of your model, the choices might be
      the list of encoder classes we know about and can instantiate.  If the value we find in
      the param dictionary is not in ``choices``, we raise a ``ConfigurationError``, because
      the user specified an invalid value in their parameter file.
  default_to_first_choice: bool, optional (default=False)
      If this is ``True``, we allow the ``key`` to not be present in the parameter
      dictionary.  If the key is not present, we will use the return as the value the first
      choice in the ``choices`` list.  If this is ``False``, we raise a
      ``ConfigurationError``, because specifying the ``key`` is required (e.g., you `have` to
      specify your model class when running an experiment, but you can feel free to use
      default settings for encoders if you want).
code: def pop_choice(self, key, choices, default_to_first_choice=False):
      """
      Gets the value of ``key`` in the ``params`` dictionary, ensuring that the value is one of
      the given choices. Note that this `pops` the key from params, modifying the dictionary,
      consistent with how parameters are processed in this codebase.
  
      Parameters
      ----------
      key: str
          Key to get the value from in the param dictionary
      choices: List[Any]
          A list of valid options for values corresponding to ``key``.  For example, if you're
          specifying the type of encoder to use for some part of your model, the choices might be
          the list of encoder classes we know about and can instantiate.  If the value we find in
          the param dictionary is not in ``choices``, we raise a ``ConfigurationError``, because
          the user specified an invalid value in their parameter file.
      default_to_first_choice: bool, optional (default=False)
          If this is ``True``, we allow the ``key`` to not be present in the parameter
          dictionary.  If the key is not present, we will use the return as the value the first
          choice in the ``choices`` list.  If this is ``False``, we raise a
          ``ConfigurationError``, because specifying the ``key`` is required (e.g., you `have` to
          specify your model class when running an experiment, but you can feel free to use
          default settings for encoders if you want).
      """
      default = choices[0] if default_to_first_choice else self.DEFAULT
      value = self.pop(key, default)
      if value not in choices:
          key_str = self.history + key
          message = "%s not in acceptable choices for %s: %s" % (
              value,
              key_str,
              unicode(choices),
          )
          raise ConfigurationError(message)
      return value
  
imports: from __future__ import with_statement
  from __future__ import absolute_import
  from collections import MutableMapping, OrderedDict
  import copy
  import json
  import logging
  import os
  from io import open
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.file_utils import cached_path
label_desc: Use image node_id 8 for calling the Params obj's underlying member method code with example usage: obj.pop_choice(key, choices, default_to_first_choice) and returns: value