def schema_keys(schema):
def _get_leaf(value):<EOL><INDENT>if isinstance(value, Schema):<EOL><INDENT>return _get_leaf(value._schema)<EOL><DEDENT>return value<EOL><DEDENT>keys = set()<EOL>dict_ = schema._schema<EOL>assert isinstance(dict_, dict)<EOL>for key in dict_.iterkeys():<EOL><INDENT>key_ = _get_leaf(key)<EOL>if isinstance(key_, basestring):<EOL><INDENT>keys.add(key_)<EOL><DEDENT><DEDENT>return keys<EOL>
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})