import gzip


def open_input(filename):
    """Handle zipped or unzipped input"""
    if filename.endswith(".gz"):
        handler = gzip.open( filename, "rt")
    else:
        handler = open( filename, "r")
    return handler