def EncodePOSIXShellArgument(argument):
 if (not isinstance(argument, str)):
  argument = str(argument)
 if _quote.search(argument):
  quote = '"'
 else:
  quote = ''
 encoded = ((quote + re.sub(_escape, '\\\\\\1', argument)) + quote)
 return encoded

def EncodePOSIXShellArgument ( argument ) : if ( not isinstance ( argument , str ) ) : argument = str ( argument ) if _quote . search ( argument ) : quote = '"' else : quote = '' encoded = ( ( quote + re . sub ( _escape , '\\\\\\1' , argument ) ) + quote ) return encoded
encodes |argument| suitably for consumption by posix shells .