parameters: (*keys)
return_statement: return validate
docstring: Validate that exactly one of the given keys exist in the config.
docstring_summary: Validate that exactly one of the given keys exist in the config.
docstring_tokens: Validate that exactly one of the given keys exist in the config .
function: def has_exactly_one_key(*keys):
      """Validate that exactly one of the given keys exist in the config."""
  
      def validate(obj):
          if not isinstance(obj, dict):
              raise Invalid("expected dictionary")
  
          number = sum(k in keys for k in obj)
          if number > 1:
              raise Invalid(f"Cannot specify more than one of {', '.join(keys)}.")
          if number < 1:
              raise Invalid(f"Must contain exactly one of {', '.join(keys)}.")
          return obj
  
      return validate
function_tokens: def has_exactly_one_key ( * keys ) : def validate ( obj ) : if not isinstance ( obj , dict ) : raise Invalid ( "expected dictionary" ) number = sum ( k in keys for k in obj ) if number > 1 : raise Invalid ( f"Cannot specify more than one of {', '.join(keys)}." ) if number < 1 : raise Invalid ( f"Must contain exactly one of {', '.join(keys)}." ) return obj return validate