<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def printStack(self,wrappedStack,include=None,filters=["*"]):
 """Prints the stack"""

        rawStack = wrappedStack['rawStack']
        print "==== Stack {} ====".format(rawStack.name)
        print "Status: {} {}".format(rawStack.stack_status,defaultify(rawStack.stack_status_reason,''))

        for resourceType, resources in wrappedStack['resourcesByTypeIndex'].items():
            if resourceType in AwsProcessor.resourceTypeAliases:
                resourceType = AwsProcessor.resourceTypeAliases[resourceType];
            if (None == include or resourceType in include) and len(resources):
                print "== {}:".format(resourceType)
                logicalIdWidth = 1
                resourceStatusWidth = 1
                resourceStatusReasonWidth = 1
                for index, resource in resources.items():
                    logicalIdWidth = max(logicalIdWidth,len(resource.logical_id))
                    resourceStatusWidth = min(50,max(resourceStatusWidth,len(resource.resource_status)))
                    resourceStatusReasonWidth = min(50,max(resourceStatusReasonWidth,len(defaultify(resource.resource_status_reason,''))))
                frm = "    {{0:3d}}: {{1:{0}}} {{2:{1}}} {{3}}".format(logicalIdWidth,resourceStatusWidth)
                for index, resource in resources.items():
                    if fnmatches(resource.logical_id.lower(),filters):
                        print frm.format(index,resource.logical_id,
                                         elipsifyMiddle(repr(resource.resource_status),50),
                                         elipsifyMiddle(repr(defaultify(resource.resource_status_reason,'')),150))