def OpenFile(self, filepath):
    """open()-replacement that automatically handles zip files.

    This assumes there is at most one .zip in the file path.
    Args:
      filepath: the path to the file to open.
    Returns:
      An open file-like object.
    """
    archive = False
    if '.zip/' in filepath:
      archive = True
      archive_type = '.zip'
    if '.par/' in filepath:
      archive = True
      archive_type = '.par'
    if archive:
      path, archived_file = filepath.split(archive_type)
      path += archive_type
      zip_file = zipfile.ZipFile(path)
      return zip_file.open(archived_file.strip('/'))
    return open(filepath)
open()-replacement that automatically handles zip files.

    This assumes there is at most one .zip in the file path.
    Args:
      filepath: the path to the file to open.
    Returns:
      An open file-like object.