def _convert_definition(self, definition, ref=None):
        """
        Converts any object to its troposphere equivalent, if applicable.
        This function will recurse into lists and mappings to create
        additional objects as necessary.
        """
        if isinstance(definition, Mapping):
            if 'Type' in definition:  # this is an AWS Resource
                expected_type = None
                try:
                    expected_type = self.inspect_resources[definition['Type']]
                except KeyError:
                    # if the user uses the custom way to name custom resources,
                    # we'll dynamically create a new subclass for this use and
                    # pass that instead of the typical CustomObject resource
                    try:
                        expected_type = self._generate_custom_type(
                            definition['Type'])
                    except __HOLE__:
                        assert not expected_type

                if expected_type:
                    args = self._normalize_properties(definition)
                    return self._create_instance(expected_type, args, ref)

            if len(definition) == 1:  # This might be a function?
                function_type = self._get_function_type(
                    definition.keys()[0])
                if function_type:
                    return self._create_instance(
                        function_type, definition.values()[0])

            # nothing special here - return as dict
            return {k: self._convert_definition(v)
                    for k, v in definition.iteritems()}

        elif (isinstance(definition, Sequence) and
                not isinstance(definition, basestring)):
            return [self._convert_definition(v) for v in definition]

        # anything else is returned as-is
        return definition
dataset/ETHPy150Open cloudtools/troposphere/troposphere/template_generator.py/TemplateGenerator._convert_definition