original_docstring:  Query the properties values of |HasProps| instances with a
          predicate.
  
          Args:
              query (callable) :
                  A callable that accepts property descriptors and returns True
                  or False
  
              include_defaults (bool, optional) :
                  Whether to include properties that have not been explicitly
                  set by a user (default: True)
  
          Returns:
              dict : mapping of property names and values for matching properties
  
          
docstring: Query the properties values of |HasProps| instances with a
  predicate.
docstring_tokens: Query the properties values of |HasProps| instances with a predicate .
code: def query_properties_with_values(self, query, include_defaults=True):
          ''' Query the properties values of |HasProps| instances with a
          predicate.
  
          Args:
              query (callable) :
                  A callable that accepts property descriptors and returns True
                  or False
  
              include_defaults (bool, optional) :
                  Whether to include properties that have not been explicitly
                  set by a user (default: True)
  
          Returns:
              dict : mapping of property names and values for matching properties
  
          '''
          themed_keys = set()
          result = dict()
          if include_defaults:
              keys = self.properties()
          else:
              # TODO (bev) For now, include unstable default values. Things rely on Instances
              # always getting serialized, even defaults, and adding unstable defaults here
              # accomplishes that. Unmodified defaults for property value containers will be
              # weeded out below.
              keys = set(self._property_values.keys()) | set(self._unstable_default_values.keys())
              if self.themed_values():
                  themed_keys = set(self.themed_values().keys())
                  keys |= themed_keys
  
          for key in keys:
              descriptor = self.lookup(key)
              if not query(descriptor):
                  continue
  
              value = descriptor.serializable_value(self)
              if not include_defaults and key not in themed_keys:
                  if isinstance(value, PropertyValueContainer) and key in self._unstable_default_values:
                      continue
              result[key] = value
  
          return result
code_tokens: def query_properties_with_values ( self , query , include_defaults = True ) : themed_keys = set ( ) result = dict ( ) if include_defaults : keys = self . properties ( ) else : keys = set ( self . _property_values . keys ( ) ) | set ( self . _unstable_default_values . keys ( ) ) if self . themed_values ( ) : themed_keys = set ( self . themed_values ( ) . keys ( ) ) keys |= themed_keys for key in keys : descriptor = self . lookup ( key ) if not query ( descriptor ) : continue value = descriptor . serializable_value ( self ) if not include_defaults and key not in themed_keys : if isinstance ( value , PropertyValueContainer ) and key in self . _unstable_default_values : continue result [ key ] = value return result
short_docstring: Query the properties values of |HasProps| instances with a
  predicate.
short_docstring_tokens: Query the properties values of |HasProps| instances with a predicate .
comment: ''' Query the properties values of |HasProps| instances with a
          predicate.
  
          Args:
              query (callable) :
                  A callable that accepts property descriptors and returns True
                  or False
  
              include_defaults (bool, optional) :
                  Whether to include properties that have not been explicitly
                  set by a user (default: True)
  
          Returns:
              dict : mapping of property names and values for matching properties
  
          '''$SEP$# TODO (bev) For now, include unstable default values. Things rely on Instances$SEP$# always getting serialized, even defaults, and adding unstable defaults here$SEP$# accomplishes that. Unmodified defaults for property value containers will be$SEP$# weeded out below.