import gzip


def _OpenMaybeGz(path):
  """Calls `gzip.open()` if |path| ends in ".gz", otherwise calls `open()`."""
  if path.endswith('.gz'):
    return gzip.open(path, 'rb')
  return open(path, 'rb')