parameters: (self, predictions, predict_keys)
return_statement: return predictions
docstring: Extracts `predict_keys` from `predictions`.
docstring_summary: Extracts `predict_keys` from `predictions`.
docstring_tokens: Extracts predict_keys from predictions .
function: def _extract_keys(self, predictions, predict_keys):
      """Extracts `predict_keys` from `predictions`."""
      if not predict_keys:
        return predictions
      if not isinstance(predictions, dict):
        raise ValueError(
            'predict_keys argument is not valid in case of non-dict predictions.')
      existing_keys = predictions.keys()
      predictions = {
          key: value
          for key, value in six.iteritems(predictions) if key in predict_keys
      }
      if not predictions:
        raise ValueError('Expected to run at least one output from %s, '
                         'provided %s.' % (existing_keys, predict_keys))
      return predictions
function_tokens: def _extract_keys ( self , predictions , predict_keys ) : if not predict_keys : return predictions if not isinstance ( predictions , dict ) : raise ValueError ( 'predict_keys argument is not valid in case of non-dict predictions.' ) existing_keys = predictions . keys ( ) predictions = { key : value for key , value in six . iteritems ( predictions ) if key in predict_keys } if not predictions : raise ValueError ( 'Expected to run at least one output from %s, ' 'provided %s.' % ( existing_keys , predict_keys ) ) return predictions