parameters: (s: str)
return_statement: return new_name
docstring: Escape strings
  
      Escape the following:
      - escape char: \x81
      - unallowed filename chars: https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words
      - control chars < 0x20
docstring_summary: Escape strings
docstring_tokens: Escape strings
function: def escape_string(s: str) -> str:
      """
      Escape strings
  
      Escape the following:
      - escape char: \x81
      - unallowed filename chars: https://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words
      - control chars < 0x20
      """
      new_name = ""
      for char in s:
          if char == "\x81":
              new_name += "\x81\x79"
          elif char in '/":*|\\?%<>' or ord(char) < 0x20:
              new_name += "\x81" + chr(0x80 + ord(char))
          else:
              new_name += char
      return new_name
function_tokens: def escape_string ( s : str ) -> str : new_name = "" for char in s : if char == "\x81" : new_name += "\x81\x79" elif char in '/":*|\\?%<>' or ord ( char ) < 0x20 : new_name += "\x81" + chr ( 0x80 + ord ( char ) ) else : new_name += char return new_name