def get_source(label, source_type, **kwargs):
if source_type not in yapconf.ALL_SUPPORTED_SOURCES:<EOL><INDENT>raise YapconfSourceError(<EOL>'<STR_LIT>' %<EOL>(source_type, yapconf.ALL_SUPPORTED_SOURCES)<EOL>)<EOL><DEDENT>if source_type not in yapconf.SUPPORTED_SOURCES:<EOL><INDENT>raise YapconfSourceError(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>' %<EOL>(source_type, source_type, yapconf.SUPPORTED_SOURCES,<EOL>yapconf.ALL_SUPPORTED_SOURCES)<EOL>)<EOL><DEDENT>if source_type == '<STR_LIT>':<EOL><INDENT>return DictConfigSource(label, data=kwargs.get('<STR_LIT:data>'))<EOL><DEDENT>elif source_type == '<STR_LIT>':<EOL><INDENT>return JsonConfigSource(label, **kwargs)<EOL><DEDENT>elif source_type == '<STR_LIT>':<EOL><INDENT>filename = kwargs.get('<STR_LIT:filename>')<EOL>if '<STR_LIT:filename>' in kwargs:<EOL><INDENT>kwargs.pop('<STR_LIT:filename>')<EOL><DEDENT>return YamlConfigSource(label, filename, **kwargs)<EOL><DEDENT>elif source_type == '<STR_LIT>':<EOL><INDENT>return EnvironmentConfigSource(label)<EOL><DEDENT>elif source_type == '<STR_LIT>':<EOL><INDENT>return EtcdConfigSource(<EOL>label, kwargs.get('<STR_LIT>'), kwargs.get('<STR_LIT:key>', '<STR_LIT:/>')<EOL>)<EOL><DEDENT>elif source_type == '<STR_LIT>':<EOL><INDENT>name = kwargs.get('<STR_LIT:name>')<EOL>if '<STR_LIT:name>' in kwargs:<EOL><INDENT>kwargs.pop('<STR_LIT:name>')<EOL><DEDENT>client = kwargs.get('<STR_LIT>')<EOL>if '<STR_LIT>' in kwargs:<EOL><INDENT>kwargs.pop('<STR_LIT>')<EOL><DEDENT>return KubernetesConfigSource(label, client, name, **kwargs)<EOL><DEDENT>else:<EOL><INDENT>raise NotImplementedError(<EOL>'<STR_LIT>' % source_type<EOL>)<EOL><DEDENT>
Get a config source based on type and keyword args.

    This is meant to be used internally by the spec via ``add_source``.

    Args:
        label (str): The label for this source.
        source_type: The type of source. See ``yapconf.SUPPORTED_SOURCES``

    Keyword Args:
        The keyword arguments are based on the source_type. Please see the
        documentation of the individual sources for a detailed list of all
        possible arguments.

    Returns (yapconf.sources.ConfigSource):
        A valid config source which can be used for generating an override.

    Raises:
        YapconfSourceError: If there is some kind of error with this source
        definition.