code: def _get_template_dict(template):
      
      if isinstance(template, str):
          return parse_template(template)
  
      if isinstance(template, dict):
          return copy.deepcopy(template)
  
      raise ValueError('Input template should be a string or dictionary')
docs: Parse string template and or copy dictionary template.
  
      :param template: Content of a packaged YAML or JSON SAM template
      :type template: str_or_dict
      :return: Template as a dictionary
      :rtype: dict
      :raises ValueError