def safe_input(prompt):
if sys.version_info < (<NUM_LIT:3>,<NUM_LIT:0>):<EOL><INDENT>if isinstance(prompt, compat.text_type):<EOL><INDENT>encoding = locale.getpreferredencoding() or '<STR_LIT:utf-8>'<EOL>prompt = prompt.encode(encoding)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if not isinstance(prompt, compat.text_type):<EOL><INDENT>prompt = prompt.decode()<EOL><DEDENT><DEDENT>return _input(prompt)<EOL>
Prompts user for input. Correctly handles prompt message encoding.