@contextlib.contextmanager<EOL>def _create_file():
f = wave.open('<STR_LIT>', mode='<STR_LIT:wb>')<EOL>f.setnchannels(<NUM_LIT:2>)<EOL>p = pyaudio.PyAudio()<EOL>f.setsampwidth(p.get_sample_size(pyaudio.paInt16))<EOL>f.setframerate(p.get_default_input_device_info()['<STR_LIT>'])<EOL>try:<EOL><INDENT>yield f<EOL><DEDENT>finally:<EOL><INDENT>f.close()<EOL><DEDENT>
Returns a file handle which is used to record audio