def open_input_file(filename):
  """Open file for reading.

  Args:
    filename: Name of input file to open or None to open stdin.

  Returns:
    Opened file if string provided, stdin if filename is None.
  """
  # TODO(rafek): Detect missing or invalid files, generating user friendly
  # error messages.
  if filename is None:
    return sys.stdin
  else:
    try:
      return open(filename, 'rb')
    except __HOLE__, err:
      fatal_error(str(err))
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/gen_protorpc.py/open_input_file