import gzip


def read_wet_file(wet_file, max_lines=-1):
    """
    Args:
        wet_file (str): path to input WET file (gz format).
        max_lines (int): maximum number of lines to read.
    Returns: WET file in the form of a list.
    """
    output = []
    with gzip.open(wet_file, mode='rt', encoding='utf-8') as f:
        for i, line in enumerate(f):
            output.append(line.strip())
            if i > max_lines and max_lines > 0:
                break

    return output