parameters: (string_like: AnyStr)
return_statement: return string_like
docstring: Canonicalizes a line of HHAS output by escaping non-UTF8 chars
docstring_summary: Canonicalizes a line of HHAS output by escaping non-UTF8 chars
docstring_tokens: Canonicalizes a line of HHAS output by escaping non - UTF8 chars
function: def canon(string_like: AnyStr) -> str:
      """Canonicalizes a line of HHAS output by escaping non-UTF8 chars"""
      if isinstance(string_like, bytes):
          return string_like.decode("utf-8", "backslashreplace")
      assert isinstance(string_like, str)
      return string_like
function_tokens: def canon ( string_like : AnyStr ) -> str : if isinstance ( string_like , bytes ) : return string_like . decode ( "utf-8" , "backslashreplace" ) assert isinstance ( string_like , str ) return string_like