code: def load(self, template, parameters=None):
      
      # load template
      if isinstance(template, str):
        self.template = template
      elif isinstance(template, file):
        try:
          self.template = template.read()
          template.close()
        except IOError as error:
          fail("Exception loading template from file: ", error)
      else:
        fail("Unknown type loading template; expected string or file: " + type(template))
  
      # load parameters, if any
      if parameters:
        if isinstance(parameters, str):
          try:
            self.parameters = yaml.safe_load(parameters)
          except ValueError as error:
            fail("Exception loading parameters from string: ", error)
        elif isinstance(parameters, file):
          try:
            self.parameters = yaml.safe_load(parameters)
            parameters.close()
          except ValueError as error:
            fail("Exception loading parameters from file: {}".format(error), sys.exc_info())
        elif isinstance(parameters, dict):
          self.parameters = parameters
        else:
          fail("Unknown type loading parameters; expected string, file, or dict: " + type(parameters))
        # sanity check the loaded parameters
        if "params" not in self.parameters:
          fail("'params' field not found in parameters")
        # just the params, please
        self.parameters = self.parameters["params"]
        # are all the keys valid (must have legal characters)
        for k in set().union(*(self.parameters[d].keys() for d in self.parameters.keys())):
          invalid_char = re.search(ILLEGAL_PARAMETER_CHARS, k)
          if invalid_char:
            fail("illegal character: '" + invalid_char.group(0) + "' in parameter key: " + k)
docs: 'template'
      Loads template text from a 'string' or 'file' type
      Template text contains {{TOKEN}} symbols to be replaced
  
      'parameters'
      parameters contains environment-specific sections as discussed in the class documentation.
      the 'parameters' arg can be None, a 'string', 'file', or 'dictionary'
  
      Whether from a string or file, or already in a dictionary, parameters must follow the
      logical format documented in the class docstring.
      if 'parameters' is omitted, template resolution will proceed with AWS, credential, and
      version lookups.