code: def escape_yaml(raw_str: str) -> str:
      
      escape_list = [char for char in raw_str if char in ['!', '{', '[']]
      if len(escape_list) == 0:
          return raw_str
  
      str_quotes = '"'
      i_str_quotes = "'"
      if str_quotes in raw_str and str_quotes not in raw_str[1:-1]:
          return raw_str
  
      if str_quotes in raw_str[1:-1]:
          raw_str = i_str_quotes + raw_str + i_str_quotes
      else:
          raw_str = str_quotes + raw_str + str_quotes
      return raw_str
docs: Shell-Escape a yaml input string.
  
      Args:
          raw_str: The unescaped string.