def count_fds():
proc_fds = '<STR_LIT>'.format(os.getpid())<EOL>if os.path.isdir(proc_fds):<EOL><INDENT>return len(proc_fds)<EOL><DEDENT>else:<EOL><INDENT>with TemporaryFile() as tf:<EOL><INDENT>return tf.fileno()<EOL><DEDENT><DEDENT>
utility for counting file descriptors