code: def schema_keys(schema):
      
      def _get_leaf(value):
          if isinstance(value, Schema):
              return _get_leaf(value._schema)
          return value
  
      keys = set()
      dict_ = schema._schema
      assert isinstance(dict_, dict)
  
      for key in dict_.iterkeys():
          key_ = _get_leaf(key)
          if isinstance(key_, basestring):
              keys.add(key_)
  
      return keys
docs: Get the string values of keys in a dict-based schema.
  
      Non-string keys are ignored.
  
      Returns:
          Set of string keys of a schema which is in the form (eg):
  
              schema = Schema({Required("foo"): int,
                               Optional("bah"): basestring})