parameters: (pathname)
return_statement: return drive + pathname
docstring: Escape all special characters.
docstring_summary: Escape all special characters.
docstring_tokens: Escape all special characters .
function: def escape(pathname):
      """Escape all special characters.
      """
      # Escaping is done by wrapping any of "*?[" between square brackets.
      # Metacharacters do not work in the drive part and shouldn't be escaped.
      drive, pathname = os.path.splitdrive(pathname)
      if isinstance(pathname, bytes):
          pathname = magic_check_bytes.sub(br'[\1]', pathname)
      else:
          pathname = magic_check.sub(r'[\1]', pathname)
      return drive + pathname
function_tokens: def escape ( pathname ) : # Escaping is done by wrapping any of "*?[" between square brackets. # Metacharacters do not work in the drive part and shouldn't be escaped. drive , pathname = os . path . splitdrive ( pathname ) if isinstance ( pathname , bytes ) : pathname = magic_check_bytes . sub ( br'[\1]' , pathname ) else : pathname = magic_check . sub ( r'[\1]' , pathname ) return drive + pathname