import gzip


def GzippableFileType(*args, **kwargs):
    """
    A wrapper around file type that transparently handles gzip files.
    """
    def ret(fname):
        if fname.endswith(".gz"):
            return gzip.open(fname, *args, **kwargs)
        else:
            return open(fname, *args, **kwargs)
    return ret