""" Load dependencies """
from troposphere import (
    Ref, Output
)

from stacker.blueprints.base import Blueprint
from stacker.blueprints.variables.types import (
    CFNString,
    CFNCommaDelimitedList,
)

class generic_resource_creator(Blueprint):
    """ Generic Blueprint for creating a resource """
    def add_cfn_description(self):
        """ Boilerplate for CFN Template """
        template = self.template
        template.add_version('2010-09-09')
        template.add_description('Generic Resource Creator - 1.0.0')

    """

    *** NOTE ***    Template Version Reminder

    Make Sure you bump up the template version number above if submitting
    updates to the repo. This is the only way we can tell which version of
    a template is in place on a running resouce.

    """

    VARIABLES = {
        'Class':
            {'type': str,
             'description': 'The troposphere class to create'},
        'Output':
            {'type': str,
             'description': 'The output to create'},
        'Properties':
            {'type': dict,
             'description': 'The list of propertie to use for the troposphere class'},
    }

    def setup_resource(self):
        template = self.template
        variables = self.get_variables()

        tclass = variables['Class']
        tprops = variables['Properties']
        output = variables['Output']

        klass = self.get_class('troposphere.' + tclass)

        # we need to do the following because of type conversion issues
        tprops_string = {}
        for variable, value in tprops.items():
          tprops_string[variable] = str(value)

        instance = klass.from_dict('ResourceRefName', tprops_string)

        template.add_resource(instance)
        template.add_output(Output(
            output,
            Description="The output",
            Value=Ref(instance)
        ))

    def create_template(self):
        """ Create the CFN template """
        self.add_cfn_description()
        self.setup_resource()

    def get_class(self, kls):
        parts = kls.split('.')
        module = ".".join(parts[:-1])
        m = __import__( module )
        for comp in parts[1:]:
            m = getattr(m, comp)            
        return m

@@ -113,109 +113,16 @@
 rint
-%0Afrom stacker.blueprints.variables.types import (%0A    CFNString,%0A    CFNCommaDelimitedList,%0A)
 %0A%0Aclass 
 gene
@@ -121,26 +121,24 @@
 ass 
-g
+G
 eneric
-_r
+R
 esource
-_c
+C
 reat
@@ -396,16 +396,20 @@
 iption('
+CGM 
 Generic 
@@ -1087,32 +1087,68 @@
 resource(self):%0A
+        %22%22%22 Setting Up Resource %22%22%22%0A
         template
@@ -1526,32 +1526,34 @@
 ms():%0A          
+  
 tprops_string%5Bva
@@ -1989,16 +1989,51 @@
 , kls):%0A
+        %22%22%22 Get class function %22%22%22%0A
         
@@ -2102,16 +2102,18 @@
        m
+od
  = __imp
@@ -2118,24 +2118,22 @@
 mport__(
- 
 module
- 
 )%0A      
@@ -2170,16 +2170,18 @@
        m
+od
  = getat
@@ -2188,27 +2188,17 @@
 tr(m
+od
 , comp)
-            
 %0A   
@@ -2210,9 +2210,11 @@
 return m
+od
 %0A

rename for linter, cleanup