<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def escape_yaml(raw_str: str) -> str: """ Shell-Escape a yaml input string. Args: raw_str: The unescaped string. """

    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