class_docstr: This class is designed to be used with the "with" construct in python
  to open files. It is similar to the python open() function, but
  treats the input "-" specially to return either sys.stdout or sys.stdin
  depending on whether the mode is "w" or "r".
  
  e.g.: with smart_open(filename, 'w') as fh:
          print ("foo", file=fh)
class_docstr_tok: ["This","class","is","designed","to","be","used","with","the","``","with","''","construct","in","python","to","open","files",".","It","is","similar","to","the","python","open","(",")","function",",","but","treats","the","input","``","-","''","specially","to","return","either","sys.stdout","or","sys.stdin","depending","on","whether","the","mode","is","``","w","''","or","``","r","''",".","e.g",".",":","with","smart_open","(","filename",",","'","w","'",")","as","fh",":","print","(","``","foo","''",",","file=fh",")"]
code: def __enter__(self):
      if self.filename == "-" and self.mode == "w":
          self.file_handle = sys.stdout
      elif self.filename == "-" and self.mode == "r":
          self.file_handle = sys.stdin
      else:
          self.file_handle = open(self.filename, self.mode)
      return self.file_handle
  
imports: from __future__ import print_function
  from __future__ import division
  import argparse
  import logging
  import math
  import os
  import subprocess
  import sys
  import threading
label_desc: Use image node_id 2 for calling the smart_open obj's underlying member method code with example usage: obj.__enter__() and returns: self