code: def _handle_sub_value(self, sub_value, handler_method):
          
  
          # Just handle known references within the string to be substituted and return the whole dictionary
          # because that's the best we can do here.
          if isinstance(sub_value, string_types):
              # Ex: {Fn::Sub: "some string"}
              sub_value = self._sub_all_refs(sub_value, handler_method)
  
          elif isinstance(sub_value, list) and len(sub_value) > 0 and isinstance(sub_value[0], string_types):
              # Ex: {Fn::Sub: ["some string", {a:b}] }
              sub_value[0] = self._sub_all_refs(sub_value[0], handler_method)
  
          return sub_value
docs: Generic method to handle value to Fn::Sub key. We are interested in parsing the ${} syntaxes inside
          the string portion of the value.
  
          :param sub_value: Value of the Sub function
          :param handler_method: Method to be called on every occurrence of `${LogicalId}` structure within the string.
              Implementation could resolve and replace this structure with whatever they seem fit
          :return: Resolved value of the Sub dictionary