parameters: (self, container, key, value_type,
                       optional=False,
                       parent_element='policy',
                       container_name=None,
                       identifier=None,
                       offending='__CONTAINER__',
                       regexp_check=None)
return_statement: return value
docstring: Checks |container| for presence of |key| with value of type |value_type|.
      If |value_type| is string and |regexp_check| is specified, then an error is
      reported when the value does not match the regular expression object.
  
      The other parameters are needed to generate, if applicable, an appropriate
      human-readable error message of the following form:
  
      In |parent_element| |identifier|:
        (if the key is not present):
        Error: |container_name| must have a |value_type| named |key|.
        Offending snippet: |offending| (if specified; defaults to |container|)
        (if the value does not have the required type):
        Error: Value of |key| must be a |value_type|.
        Offending snippet: |container[key]|
  
      Returns: |container[key]| if the key is present, None otherwise.
docstring_summary: Checks |container| for presence of |key| with value of type |value_type|.
      If |value_type| is string and |regexp_check| is specified, then an error is
      reported when the value does not match the regular expression object.
docstring_tokens: Checks |container| for presence of |key| with value of type |value_type| . If |value_type| is string and |regexp_check| is specified then an error is reported when the value does not match the regular expression object .
function: def _CheckContains(self, container, key, value_type,
                       optional=False,
                       parent_element='policy',
                       container_name=None,
                       identifier=None,
                       offending='__CONTAINER__',
                       regexp_check=None):
      '''
      Checks |container| for presence of |key| with value of type |value_type|.
      If |value_type| is string and |regexp_check| is specified, then an error is
      reported when the value does not match the regular expression object.
  
      The other parameters are needed to generate, if applicable, an appropriate
      human-readable error message of the following form:
  
      In |parent_element| |identifier|:
        (if the key is not present):
        Error: |container_name| must have a |value_type| named |key|.
        Offending snippet: |offending| (if specified; defaults to |container|)
        (if the value does not have the required type):
        Error: Value of |key| must be a |value_type|.
        Offending snippet: |container[key]|
  
      Returns: |container[key]| if the key is present, None otherwise.
      '''
      if identifier is None:
        identifier = container.get('name')
      if container_name is None:
        container_name = parent_element
      if offending == '__CONTAINER__':
        offending = container
      if key not in container:
        if optional:
          return
        else:
          self._Error('%s must have a %s "%s".' %
                      (container_name.title(), value_type.__name__, key),
                      container_name, identifier, offending)
        return None
      value = container[key]
      if not isinstance(value, value_type):
        self._Error('Value of "%s" must be a %s.' %
                    (key, value_type.__name__),
                    container_name, identifier, value)
      if value_type == str and regexp_check and not regexp_check.match(value):
        self._Error('Value of "%s" must match "%s".' %
                    (key, regexp_check.pattern),
                    container_name, identifier, value)
      return value
function_tokens: def _CheckContains ( self , container , key , value_type , optional = False , parent_element = 'policy' , container_name = None , identifier = None , offending = '__CONTAINER__' , regexp_check = None ) : if identifier is None : identifier = container . get ( 'name' ) if container_name is None : container_name = parent_element if offending == '__CONTAINER__' : offending = container if key not in container : if optional : return else : self . _Error ( '%s must have a %s "%s".' % ( container_name . title ( ) , value_type . __name__ , key ) , container_name , identifier , offending ) return None value = container [ key ] if not isinstance ( value , value_type ) : self . _Error ( 'Value of "%s" must be a %s.' % ( key , value_type . __name__ ) , container_name , identifier , value ) if value_type == str and regexp_check and not regexp_check . match ( value ) : self . _Error ( 'Value of "%s" must match "%s".' % ( key , regexp_check . pattern ) , container_name , identifier , value ) return value