code: def validate(template_dict, schema=None):
          
  
          if not schema:
              schema = SamTemplateValidator._read_schema()
  
          validation_errors = ""
  
          try:
              jsonschema.validate(template_dict, schema)
          except ValidationError as ex:
              # Stringifying the exception will give us useful error message
              validation_errors = str(ex)
              # Swallowing expected exception here as our caller is expecting validation errors and
              # not the valiation exception itself
              pass
  
          return validation_errors
docs: Is this a valid SAM template dictionary
  
          :param dict template_dict: Data to be validated
          :param dict schema: Optional, dictionary containing JSON Schema representing SAM template
          :return: Empty string if there are no validation errors in template