docs: def openReadWrite(filename):
      """
      Return a 2-tuple of: (whether the file existed before, open file object)
      """
      try:
          os.makedirs(os.path.dirname(filename))
      except OSError:
          pass
      try:
          return file(filename, 'rb+')
      except IOError:
          return file(filename, 'wb+')