import gzip


def gzopen(filename,mode='r'):
    """
    Open file or gzip file
    """
    if filename.endswith('.gz'):
        file = gzip.open(filename, mode)
    else:
        file = open(filename, mode)
    return file