code: def strip_app_metadata(template_dict):
      
      if SERVERLESS_REPO_APPLICATION not in template_dict.get(METADATA, {}):
          return template_dict
  
      template_dict_copy = copy.deepcopy(template_dict)
  
      # strip the whole metadata section if SERVERLESS_REPO_APPLICATION is the only key in it
      if not [k for k in template_dict_copy.get(METADATA) if k != SERVERLESS_REPO_APPLICATION]:
          template_dict_copy.pop(METADATA, None)
      else:
          template_dict_copy.get(METADATA).pop(SERVERLESS_REPO_APPLICATION, None)
  
      return template_dict_copy
docs: Strip the "AWS::ServerlessRepo::Application" metadata section from template.
  
      :param template_dict: SAM template as a dictionary
      :type template_dict: dict
      :return: stripped template content
      :rtype: str